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: nob...@puremagic.com
          Reporter: d...@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.

--

Reply via email to