July 15, 2013 [Issue 10649] New: immutable/const aggregate definitions not consistent | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: public@dicebot.lv --- Comment #0 from Dicebot <public@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: ------- |
Copyright © 1999-2021 by the D Language Foundation