Bug 10649 – immutable/const aggregate definitions not consistent

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-15T12:07:17Z
Last change time
2024-12-13T18:09:30Z
Assigned to
No Owner
Creator
Dicebot
Moved to GitHub: dmd#18632 →

Comments

Comment #0 by public — 2013-07-15T12:07:17Z
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.
Comment #1 by robert.schadek — 2024-12-13T18:09:30Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18632 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB