September 22, 2014 [Issue 9372] Class member with @disabled ctor makes class ctor unusable | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9372 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #9 from Kenji Hara <k.hara.pg@gmail.com> --- The original code has been working from 2.064, by fixing issue 9665. (In reply to hsteoh from comment #0) > Code: > > -----------SNIP------------- > import std.stdio; > > struct Trouble { > @disable this(); > @disable this(this); > > int dummy; > > this(int x) { > dummy = x; > } > } > > class Room { > Trouble t; > > this() { > t = Trouble(123); By fixing issue 9665, this line is correctly handled as the initialization of the instance field 't'. Therefore the disabled default constructor won't be called on that. > } > } > > void main() { > auto r = new Room; // this is line 23 > } *** This issue has been marked as a duplicate of issue 9665 *** -- |
Copyright © 1999-2021 by the D Language Foundation