Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag16499.d(24): Error: operator `in` is not defined for type `A`
5 fail_compilation/diag16499.d(11): perhaps overload the operator with `auto opBinaryRight(string op : "in")(int rhs) {}`
6 fail_compilation/diag16499.d(26): Error: operator `in` is not defined for type `B`
7 fail_compilation/diag16499.d(12): perhaps overload the operator with `auto opBinaryRight(string op : "in")(double rhs) {}`
8 ---
9 */
10
11 struct A {}
12 struct B {
13 void* opBinaryRight(string op)(int b) if (op == "in")
14 {
15 return null;
16 }
17 }
18
19 void main()
20 {
21 A foo;
22 B bar;
23
24 2 in foo;
25 2 in bar; // OK
26 1.0 in bar;
27 }