gcc/testsuite/gdc.test/fail_compilation/ice9759.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/ice9759.d(25): Error: mutable method `ice9759.Json.opAssign` is not callable using a `const` object |
| 5 | fail_compilation/ice9759.d(17): Consider adding `const` or `inout` here |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | struct Json |
| 10 | { |
| 11 | union |
| 12 | { |
| 13 | Json[] m_array; |
| 14 | Json[string] m_object; |
| 15 | } |
| 16 | |
| 17 | void opAssign(Json v) |
| 18 | { |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | void bug() |
| 23 | { |
| 24 | const(Json) r; |
| 25 | r = r.init; |
| 26 | } |