summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/diag16499.d
blob: 63b4b3c5279509b57f3ae68e1b48f39c6544bca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
TEST_OUTPUT:
---
fail_compilation/diag16499.d(22): Error: incompatible types for `(2) in (foo)`: `int` and `A`
fail_compilation/diag16499.d(24): Error: incompatible types for `(1.0) in (bar)`: `double` and `B`
---
*/

struct A {}
struct B {
	void* opBinaryRight(string op)(int b) if (op == "in")
	{
		return null;
	}
}

void main()
{
	A foo;
	B bar;

	2 in foo;
	2 in bar; // OK
	1.0 in bar;
}