1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail297.d(30): Error: incompatible types for ((Bar()) + (baz())): 'Bar' and 'const(Bar)'
5 ---
6 */
7 
8 // Issue 1969 - ICE(cod1.c) using undefined operator with one const operand
9 
10 // 1969  ICE or wrong-code. D2 only. Internal error: backend\cod1.c 1673
11 /* Root cause: BinExp::typeCombine() is checking for an _exact_ match, but
12 typeMerge() will return success.
13 
14 PATCH: cast.c BinExp::typeCombine().
15 Compare the immutable versions of the types, instead of the types themselves.
16 
17     if (op == TOKmin || op == TOKadd)
18     {
19         if (t1->ito == t2->ito && (t1->ty == Tstruct || t1->ty == Tclass))
20             goto Lerror;
21     }
22 */
23 
24 struct Bar {}
25 
26 const(Bar) baz() { return Bar(); }
27 
28 void foo()
29 {
30     Bar result = Bar() + baz();
31 }
32