Debian Codegraph @

gcc/testsuite/gdc.test/runnable/test19729.d

raw
1 //https://issues.dlang.org/show_bug.cgi?id=19729
2 // PERMUTE_ARGS:
3 module test19729;
4
5 mixin template Templ(T)
6 {
7 this(T t)
8 {
9 }
10 }
11
12 class C // original TC
13 {
14 mixin Templ!int;
15 mixin Templ!string;
16 }
17
18 class D // named
19 {
20 mixin Templ!int ti;
21 mixin Templ!string ts;
22 }
23
24 class E // top level ctor wins
25 {
26 bool topLevelWins;
27 mixin Templ!int;
28 this(int){topLevelWins = true;}
29 }
30
31 class F // top level ctor wins even if not exact match
32 {
33 bool topLevelWins;
34 mixin Templ!ubyte;
35 this(int){topLevelWins = true;}
36 }
37
38 class G // same as F but change lexicographical order
39 {
40 bool topLevelWins;
41 this(int){topLevelWins = true;}
42 mixin Templ!ubyte;
43 }
44
45 void main()
46 {
47 auto c0 = new C("should work");
48 auto c1 = new C(42);
49
50 auto d0 = new D("should work");
51 auto d1 = new D(42);
52
53 auto e = new E(0);
54 assert(e.topLevelWins);
55
56 auto f = new F(ubyte(0));
57 assert(f.topLevelWins);
58
59 auto g = new G(ubyte(0));
60 assert(g.topLevelWins);
61 }