gcc/testsuite/gdc.test/fail_compilation/fail217.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/fail217.d(22): Error: mutable constructor `fail217.Message.this` cannot construct a `immutable` object |
| 5 | fail_compilation/fail217.d(13): Consider adding `const` or `inout` here |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | class Message |
| 10 | { |
| 11 | public int notifier; |
| 12 | |
| 13 | this( int notifier_object ) |
| 14 | { |
| 15 | notifier = notifier_object; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | void |
| 20 | main() |
| 21 | { |
| 22 | auto m2 = new immutable(Message)(2); |
| 23 | m2.notifier = 3; |
| 24 | } |