Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail9936.d(25): Error: `S().opBinary` isn't a template
5 fail_compilation/fail9936.d(26): Error: `S().opBinaryRight` isn't a template
6 fail_compilation/fail9936.d(27): Error: `S().opOpAssign` isn't a template
7 fail_compilation/fail9936.d(29): Error: `S().opIndexUnary` isn't a template
8 fail_compilation/fail9936.d(30): Error: `S().opUnary` isn't a template
9 ---
10 */
11 struct S
12 {
13 auto opBinary(S s) { return 1; }
14 auto opBinaryRight(int n) { return 1; }
15 auto opOpAssign(S s) { return 1; }
16
17 auto opIndexUnary(S s) { return 1; }
18 auto opUnary(S s) { return 1; }
19 }
20 void main()
21 {
22 static assert(!is(typeof( S() + S() )));
23 static assert(!is(typeof( 100 + S() )));
24 static assert(!is(typeof( S() += S() )));
25 S() + S();
26 100 + S();
27 S() += S();
28
29 +S()[0];
30 +S();
31 }