]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/fail1900.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail1900.d
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(42): Error: template `imports.fail1900b.Bar(short n)` at fail_compilation/imports/fail1900b.d(2) conflicts with template `imports.fail1900a.Bar(int n)` at fail_compilation/imports/fail1900a.d(2)
34 ---
35 */
36
37 import imports.fail1900a;
38 import imports.fail1900b;
39
40 void test1900b()
41 {
42 enum x = Bar!1;
43 }
44
45 /*
46 TEST_OUTPUT:
47 ---
48 fail_compilation/fail1900.d(66): Error: template `fail1900.Mix2b!().Baz(int x)` at fail_compilation/fail1900.d(58) conflicts with template `fail1900.Mix2a!().Baz(byte x)` at fail_compilation/fail1900.d(54)
49 ---
50 */
51
52 template Mix2a()
53 {
54 template Baz(byte x) {}
55 }
56 template Mix2b()
57 {
58 template Baz(int x) {}
59 }
60
61 mixin Mix2a;
62 mixin Mix2b;
63
64 void test1900c()
65 {
66 alias x = Baz!1;
67 }