Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct S
- {
- @disable this();
- this(int x) { writeln("ctor ", x); }
- void opAssign(S s) {
- writeln("assign");
- }
- ~this() { writeln("dtor"); }
- }
- class A
- {
- S s;
- this() {
- s = S(1); // opAssign/dtor is called instead of constructor??
- }
- }
- S s; // error. why??
- static this() {
- s = S(1);
- }
- void main() {
- auto a = new A;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement