[Issue 10649] New: immutable/const aggregate definitions not consistent

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 15 12:07:18 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10649

           Summary: immutable/const aggregate definitions not consistent
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: public at dicebot.lv


--- Comment #0 from Dicebot <public at dicebot.lv> 2013-07-15 12:07:17 PDT ---
immutable struct A
{
    struct B
    {
        int x;
    }

    int x;
    static int y;
}

void main()
{
    A.y = 42; // works
    A a;
    // a.x = 42; // fails
    A.B b;
    b.x = 42; // works
}

-------------------------------------

Applying const/immutable qualifier to aggregate definition propagates it only
to fields and methods of struct/class. static fields and nested definitions are
left mutable which is extremely confusing and inconsistent with usual
transitivity.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list