[Issue 16075] New: Compiler rejects basic mixin template

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed May 25 12:58:15 PDT 2016


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

          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 at puremagic.com
          Reporter: maxsamukha at 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);
F.F.foo(bool);

--


More information about the Digitalmars-d-bugs mailing list