www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13500] New: Wrong ambiguity error in second template

https://issues.dlang.org/show_bug.cgi?id=13500

          Issue ID: 13500
           Summary: Wrong ambiguity error in second template instantiation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: timon.gehr gmx.ch

With DMD 2.066.0, this compiles with version=A or version=B, but noth with both
simultaneously:

import std.typecons;

mixin template WorkingTypedef(string i,T,T init=T.init)/+if(...)+/{
    mixin Typedef!(T,init);
    mixin(`alias `~i~` =Typedef;`);
}
version(A) mixin WorkingTypedef!("Name2",int,2);
version(B) mixin WorkingTypedef!("Name1",int);

The code should compile in all three cases.

--
Sep 19 2014