digitalmars.D.bugs - [Issue 12659] New: Named mixin templates conflict
- via Digitalmars-d-bugs (55/55) Apr 26 2014 https://issues.dlang.org/show_bug.cgi?id=12659
https://issues.dlang.org/show_bug.cgi?id=12659 Issue ID: 12659 Summary: Named mixin templates conflict Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: timon.gehr gmx.ch With DMD 2.065, the following code fails to compile: import std.stdio; mixin template Foo(T){ T foo(T a){ return a; } } mixin Foo!int g; mixin Foo!string g; void main(){ writeln(foo(2)); writeln(foo("a")); writeln(g.foo(2)); writeln(g.foo("a")); } Error: mixin tt.Foo!(string) conflicts with mixin tt.Foo!(int) at tt.d(6) Similarly if two named mixins occur in different files: module b; mixin template Foo(T){ T foo(T a){ return a; } } mixin Foo!string g; // --- module c; mixin template Foo(T){ T foo(T a){ return a; } } mixin Foo!int g; // --- import std.stdio; import b,c; void main(){ writeln(foo(2)); writeln(foo("a")); writeln(g.foo(2)); writeln(g.foo("a")); } Error: b.Foo!(string) at b.d(5) conflicts with c.Foo!(int) at c.d(5) Error: function b.Foo!(string).foo (string a) is not callable using argument types (int) Error: cannot implicitly convert expression (2) of type int to string Error: b.Foo!(string) at b.d(5) conflicts with c.Foo!(int) at c.d(5) Both examples should compile. --
Apr 26 2014