diff options
Diffstat (limited to 'gcc/testsuite/gdc.test/fail_compilation/test12385.d')
-rw-r--r-- | gcc/testsuite/gdc.test/fail_compilation/test12385.d | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test12385.d b/gcc/testsuite/gdc.test/fail_compilation/test12385.d new file mode 100644 index 00000000000..cbba723fe74 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test12385.d @@ -0,0 +1,30 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test12385.d(29): Error: cannot modify `immutable` expression `unbundled.x` +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=12385 + +class BundledState +{ + string m_State; + + int x = 3; + + this(string state) immutable + { + m_State = state; + } +} + +enum States : immutable(BundledState) +{ + unbundled = new immutable BundledState("bla"), +} + +void main() +{ + States.unbundled.x = 6; // Modifies x. +} |