MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / bug9631.d
blobf0a9456035b94b7c3ef2985197afd802812676f6
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(79): Error: function `bug9631.arg.f(int i, S s)` is not callable using argument types `(int, S)`
66 fail_compilation/bug9631.d(79): cannot pass argument `y` of type `bug9631.tem!().S` to parameter `bug9631.S s`
67 fail_compilation/bug9631.d(80): Error: function literal `__lambda4(S s)` is not callable using argument types `(S)`
68 fail_compilation/bug9631.d(80): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631.tem!().S s`
69 fail_compilation/bug9631.d(86): Error: constructor `bug9631.arg.A.this(S __param_0)` is not callable using argument types `(S)`
70 fail_compilation/bug9631.d(86): cannot pass argument `S(0)` of type `bug9631.tem!().S` to parameter `bug9631.S __param_0`
71 ---
73 void arg()
75 S x;
76 tem!().S y;
78 void f(int i, S s);
79 f(4, y);
80 (tem!().S s){}(x);
82 struct A
84 this(S){}
86 A(tem!().S());
90 TEST_OUTPUT:
91 ---
92 fail_compilation/bug9631.d(106): Error: function `bug9631.targ.ft!().ft(S __param_0)` is not callable using argument types `(S)`
93 fail_compilation/bug9631.d(106): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631.tem!().S __param_0`
94 fail_compilation/bug9631.d(107): Error: template `bug9631.targ.ft` is not callable using argument types `!()(S)`
95 fail_compilation/bug9631.d(105): Candidate is: `ft()(tem!().S)`
96 fail_compilation/bug9631.d(109): Error: template `bug9631.targ.ft2` is not callable using argument types `!()(S, int)`
97 fail_compilation/bug9631.d(108): Candidate is: `ft2(T)(S, T)`
98 ---
100 void targ()
102 S x;
103 tem!().S y;
105 void ft()(tem!().S){}
106 ft!()(x);
107 ft(x);
108 void ft2(T)(S, T){}
109 ft2(y, 1);