MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail302.d
blobd1133b0eef09a253ab401d683d12e3c7023b58e5
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail302.d(23): Error: cannot implicitly convert expression `1` of type `int` to `Bar`
5 fail_compilation/fail302.d(23): `bar = 1` is the first assignment of `bar` therefore it represents its initialization
6 fail_compilation/fail302.d(23): `opAssign` methods are not used for initialization, but for subsequent assignments
7 ---
8 */
10 struct Bar
12 uint num;
14 Bar opAssign(uint otherNum)
16 num = otherNum;
17 return this;
21 void main()
23 Bar bar = 1; // disallow because construction is not assignment
24 auto x = bar.num;