www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16075] New: Compiler rejects basic mixin template


          Issue ID: 16075
           Summary: Compiler rejects basic mixin template
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

mixin template Foo(A...) {
    static if (A.length) {
        void foo(A[0] a) {

        mixin Foo!(A[1..$]) F;
        alias foo = F.foo;

mixin Foo!(int, string, bool);

void main() {

Error: alias test.Foo!(int, string, bool).Foo!(string, bool).Foo!bool.foo
recursive alias declaration

The mixin should produce properly nested overload sets of foo:

foo(int); foo(string); foo(bool);
F.foo(string); F.foo(bool);

May 25 2016