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
import std.stdio;
mixin template R() {
~this() { write(1); }
}
struct S {
mixin R;
~this() { write(2); }
}
void main() {
S s;
}
This code compiles OK and prints 21 when it should NOT.
import std.stdio;
mixin template R() {
int a = 1;
void foo() { write(a); }
}
struct S {
mixin R;
void bar() { write(a); }int a = 2;
}
void main() {
S s;
s.foo();
s.bar();
}
This code also compiles OK and prints 12 when it's strange and bug-prone.
The text was updated successfully, but these errors were encountered:
Temtaime (@Temtaime) reported this on 2014-08-31T11:07:45Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=13408
Description
import std.stdio; mixin template R() { ~this() { write(1); } } struct S { mixin R; ~this() { write(2); } } void main() { S s; } This code compiles OK and prints 21 when it should NOT. import std.stdio; mixin template R() { int a = 1; void foo() { write(a); } } struct S { mixin R; void bar() { write(a); } int a = 2; } void main() { S s; s.foo(); s.bar(); } This code also compiles OK and prints 12 when it's strange and bug-prone.The text was updated successfully, but these errors were encountered: