https://issues.dlang.org/show_bug.cgi?id=23153
Issue ID: 23153
Summary: Immutable variables should undergo same flow analysis
in module constructors as in regular constructors
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
i.e: This compiles:
```
immutable int x;
immutable int* y;
shared static this()
{
y = &x;
assert(*y == 0);
x = 42;
assert(*y == 42);
}
```
But the expected behaviour is to fail compilation, same as:
```
struct S
{
immutable int x;
this(int n)
{
auto y = &x;
assert(*y == 0);
x = n;
assert(*y == n);
}
}
```
--