[dmd-beta] D2 2.058 beta

Andrei Alexandrescu andrei at erdani.com
Fri Feb 10 12:51:37 PST 2012


Yes, this is ambiguous.

Andrei

On 2/10/12 12:05 PM, Martin Nowak wrote:
>>> This compiles for me without error. When it runs, I get a stack
>>> overflow.
>>> The reason looks clear - foo(Args) is recursively calling itself. I
>>> don't
>>> think it's a bug in dmd.
>>>
>>
>> I retried above code using new beta on two environments.
>>
>> Mac OS X 10.6.8 causes segmentation fault, but
>> Scientific Linux release 6.0 64bit works fine.
>>
>> Does D allow above code?
>
> If I understand that correctly then the chosen overload differs.
> This prints "variadic" for me. Can you recheck this for other setups
> and file a bug.
>
> IMHO this should be an ambiguous overload error.
> -----
> import std.stdio;
>
> struct S
> {
> void foo(V)(in V v)
> {
> writeln("non-variadic");
> }
>
> void foo(Args...)(auto ref const Args args)
> {
> writeln("variadic");
> }
> }
>
> void main()
> {
> S s;
> s.foo(10);
> }
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta


More information about the dmd-beta mailing list