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
class C
{
immutable int x;
this()
{
this.f(this.x = 5);
}
void f(lazy int x){}
}
C.int isn't initialized, although this code compiles.
Whether C.int is initialized or not depends on the, in general indeterministic, behavior of f(), this should be a compile time error.
The text was updated successfully, but these errors were encountered:
I think this is part of a bigger problem:
----------------------------------------
class A
{
immutable int x;
void delegate() f;this(){ x = 40; f = () { x = 42; };}
}
void main()
{
import std.stdio;
auto a = new A();
writeln(a.x);
a.f();
writeln(a.x);
}
----------------------------------------
40
42
David Eckardt reported this on 2013-06-28T09:00:44Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=10496
CC List
Description
class C { immutable int x; this() { this.f(this.x = 5); } void f(lazy int x){} } C.int isn't initialized, although this code compiles. Whether C.int is initialized or not depends on the, in general indeterministic, behavior of f(), this should be a compile time error.The text was updated successfully, but these errors were encountered: