[Issue 9372] Class member with @disabled ctor makes class ctor unusable

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 21 22:26:16 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=9372

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #9 from Kenji Hara <k.hara.pg at 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 ***

--


More information about the Digitalmars-d-bugs mailing list