[Issue 19273] New: immutable on a class declaration doesn't cause references of that type to be immutable
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Sep 28 09:30:39 UTC 2018
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 at puremagic.com
Reporter: doob at 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.
--
More information about the Digitalmars-d-bugs
mailing list