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
Related to issue 11211
struct S {
@disable this();
bool cted;this(int x) { cted = true; }void foo() { assert(cted);}
}
void bar(A a) {
a.s.foo();
}
class A {
S s;
this() {
bar(this); // shouldn't compile
s = S(1);
}
}
void main() {
auto a = new A;
}
Passing 'this' outside the constructor should be disallowed before structs with disabled constructors are initialized.
I could go on with bug reports but it is obvious that there is no good solution in the face of current compilation model.
The text was updated successfully, but these errors were encountered:
Max Samukha reported this on 2013-10-09T14:00:29Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=11212
Description
Related to issue 11211 struct S { @disable this(); bool cted; this(int x) { cted = true; } void foo() { assert(cted); } } void bar(A a) { a.s.foo(); } class A { S s; this() { bar(this); // shouldn't compile s = S(1); } } void main() { auto a = new A; } Passing 'this' outside the constructor should be disallowed before structs with disabled constructors are initialized. I could go on with bug reports but it is obvious that there is no good solution in the face of current compilation model.The text was updated successfully, but these errors were encountered: