aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/diag16499.d
blob: 5d0c6ff581f3f7d0880f866ffa704ac14107d794 (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.00000) 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;
}