You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Dicebot (@mihails-strasuns) reported this on 2013-07-15T12:07:17Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=10649
Description
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.The text was updated successfully, but these errors were encountered: