www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19871] New: Copy constructor rejects valid code if default

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

          Issue ID: 19871
           Summary: Copy constructor rejects valid code if default
                    construction is disabled
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: atila.neves gmail.com

This code crashes the compiler since 2.086.0:

------------------
struct Struct {
     disable this();
    this(ref Struct other) {
        const Struct s = void;
        this(s);
    }

    this(Struct);
}
------------------


It also issues this seemingly nonsensical error:

bug.d(6): Error: variable `bug.Struct.this.__copytmp2` default construction is
disabled for type Struct

The intention of the code is to call the by-value constructor, which used to
work.

--
May 14 2019