http://d.puremagic.com/issues/show_bug.cgi?id=9372
Summary: Class member with @disabled ctor makes class ctor unusable Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: hst...@quickfur.ath.cx --- Comment #0 from hst...@quickfur.ath.cx 2013-01-22 12:00:45 PST --- 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); } } void main() { auto r = new Room; // this is line 23 } -----------SNIP------------- Compiler error: -----------SNIP------------- test.d(23): Error: default construction is disabled for type Room -----------SNIP------------- Commenting out the @disabled lines in Trouble makes the problem go away. This behaviour makes no sense. The class ctor is a default ctor which calls the Trouble ctor with non-default arguments, so it should be allowed. I can see where this shouldn't be allowed (if Room is another struct for, example), but since Room is a class, this should be allowed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------