[Issue 19871] New: Copy constructor rejects valid code if default construction is disabled

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 14 14:27:20 UTC 2019


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 at puremagic.com
          Reporter: atila.neves at 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.

--


More information about the Digitalmars-d-bugs mailing list