d: Merge dmd. druntime e770945277, phobos 6d6e0b9b9
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / bug9631.d
blob13974aa0e9a6fa8986fb47ce51df8482b2f0b852
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/bug9631.d(20): Error: cannot implicitly convert expression `F()` of type `bug9631.T1!().F` to `bug9631.T2!().F`
5 ---
6 */
7 // DISABLED: win32
8 template T1()
10 struct F { }
13 template T2()
15 struct F { }
18 void main()
20 T2!().F x = T1!().F();
24 TEST_OUTPUT:
25 ---
26 fail_compilation/bug9631.d(41): Error: incompatible types for `(x) == (y)`: `bug9631.S` and `bug9631.tem!().S`
27 ---
30 struct S { char c; }
32 template tem()
34 struct S { int i; }
37 void equal()
39 S x;
40 auto y = tem!().S();
41 bool b = x == y;
45 TEST_OUTPUT:
46 ---
47 fail_compilation/bug9631.d(55): Error: cannot cast expression `x` of type `bug9631.S` to `bug9631.tem!().S` because of different sizes
48 fail_compilation/bug9631.d(58): Error: cannot cast expression `ta` of type `bug9631.tem!().S[1]` to `bug9631.S[1]` because of different sizes
49 fail_compilation/bug9631.d(59): Error: cannot cast expression `sa` of type `S[1]` to `S[]` since sizes don't line up
50 ---
52 void test3()
54 S x;
55 auto y = cast(tem!().S)x;
57 tem!().S[1] ta;
58 S[1] sa = cast(S[1])ta;
59 auto t2 = cast(tem!().S[])sa;
63 TEST_OUTPUT:
64 ---
65 fail_compilation/bug9631.d(80): Error: function `f` is not callable using argument types `(int, S)`
66 fail_compilation/bug9631.d(80): cannot pass argument `y` of type `bug9631.tem!().S` to parameter `bug9631.S s`
67 fail_compilation/bug9631.d(79): `bug9631.arg.f(int i, S s)` declared here
68 fail_compilation/bug9631.d(81): Error: function literal `__lambda4(S s)` is not callable using argument types `(S)`
69 fail_compilation/bug9631.d(81): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631.tem!().S s`
70 fail_compilation/bug9631.d(87): Error: constructor `bug9631.arg.A.this(S __param_0)` is not callable using argument types `(S)`
71 fail_compilation/bug9631.d(87): cannot pass argument `S(0)` of type `bug9631.tem!().S` to parameter `bug9631.S __param_0`
72 ---
74 void arg()
76 S x;
77 tem!().S y;
79 void f(int i, S s);
80 f(4, y);
81 (tem!().S s){}(x);
83 struct A
85 this(S){}
87 A(tem!().S());
91 TEST_OUTPUT:
92 ---
93 fail_compilation/bug9631.d(108): Error: function `ft` is not callable using argument types `(S)`
94 fail_compilation/bug9631.d(108): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631.tem!().S __param_0`
95 fail_compilation/bug9631.d(107): `bug9631.targ.ft!().ft(S __param_0)` declared here
96 fail_compilation/bug9631.d(109): Error: template `ft` is not callable using argument types `!()(S)`
97 fail_compilation/bug9631.d(107): Candidate is: `ft()(tem!().S)`
98 fail_compilation/bug9631.d(111): Error: template `ft2` is not callable using argument types `!()(S, int)`
99 fail_compilation/bug9631.d(110): Candidate is: `ft2(T)(S, T)`
102 void targ()
104 S x;
105 tem!().S y;
107 void ft()(tem!().S){}
108 ft!()(x);
109 ft(x);
110 void ft2(T)(S, T){}
111 ft2(y, 1);