Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/fail1900.d

raw
1 /*
2 EXTRA_FILES: imports/fail1900a.d imports/fail1900b.d
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail1900.d(27): Error: template `fail1900.Mix1a!().Foo` matches more than one template declaration:
6 fail_compilation/fail1900.d(14): `Foo(ubyte x)`
7 and:
8 fail_compilation/fail1900.d(15): `Foo(byte x)`
9 ---
10 */
11
12 template Mix1a()
13 {
14 template Foo(ubyte x) {}
15 template Foo(byte x) {}
16 }
17 template Mix1b()
18 {
19 template Foo(int x) {}
20 }
21
22 mixin Mix1a;
23 mixin Mix1b;
24
25 void test1900a()
26 {
27 alias x = Foo!1;
28 }
29
30 /*
31 TEST_OUTPUT:
32 ---
33 fail_compilation/fail1900.d(44): Error: `Bar` matches conflicting symbols:
34 fail_compilation/imports/fail1900b.d(2): template `imports.fail1900b.Bar(short n)`
35 fail_compilation/imports/fail1900a.d(2): template `imports.fail1900a.Bar(int n)`
36 ---
37 */
38
39 import imports.fail1900a;
40 import imports.fail1900b;
41
42 void test1900b()
43 {
44 enum x = Bar!1;
45 }
46
47 /*
48 TEST_OUTPUT:
49 ---
50 fail_compilation/fail1900.d(70): Error: `Baz` matches conflicting symbols:
51 fail_compilation/fail1900.d(62): template `fail1900.Mix2b!().Baz(int x)`
52 fail_compilation/fail1900.d(58): template `fail1900.Mix2a!().Baz(byte x)`
53 ---
54 */
55
56 template Mix2a()
57 {
58 template Baz(byte x) {}
59 }
60 template Mix2b()
61 {
62 template Baz(int x) {}
63 }
64
65 mixin Mix2a;
66 mixin Mix2b;
67
68 void test1900c()
69 {
70 alias x = Baz!1;
71 }