digitalmars.D.bugs - [Issue 19273] New: immutable on a class declaration doesn't cause
- d-bugmail puremagic.com (28/28) Sep 28 2018 https://issues.dlang.org/show_bug.cgi?id=19273
https://issues.dlang.org/show_bug.cgi?id=19273 Issue ID: 19273 Summary: immutable on a class declaration doesn't cause references of that type to be immutable Product: D Version: D2 Hardware: Other OS: Other Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: doob me.com This issue is best describe by an example: immutable struct Foo {} immutable class Bar {} void main() { Foo foo; Bar bar; static assert(is(typeof(foo) == immutable(Foo))); static assert(is(typeof(bar) == Bar)); } I don't expect the above code to compile, but it does. The question is why the type of "bar" is not immutable(Bar) when that's the case for "foo"? DMD 2.082.0. --
Sep 28 2018