d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail297.d
blob5fc3bbf8e575e4d205595a8feed79be6fbddfad0
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail297.d(30): Error: incompatible types for `(Bar()) + (baz())`: `Bar` and `const(Bar)`
5 ---
6 */
8 // https://issues.dlang.org/show_bug.cgi?id=1969
9 // ICE(cod1.c) using undefined operator with one const operand
10 // 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.
14 PATCH: cast.c BinExp::typeCombine().
15 Compare the immutable versions of the types, instead of the types themselves.
17 if (op == TOKmin || op == TOKadd)
19 if (t1->ito == t2->ito && (t1->ty == Tstruct || t1->ty == Tclass))
20 goto Lerror;
24 struct Bar {}
26 const(Bar) baz() { return Bar(); }
28 void foo()
30 Bar result = Bar() + baz();