[Issue 22997] New: DMD crash: copy ctor can't call other ctor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 8 15:11:16 UTC 2022


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

          Issue ID: 22997
           Summary: DMD crash: copy ctor can't call other ctor
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: submada at gmail.com

Hello, this code crash dmd:

```d
struct Forward{}

struct Foo{

    /// 1.
    this(scope ref typeof(this) rhs){
        this(rhs, Forward.init);  //call ctor 2.
    }

    /// 2.
    this(scope ref typeof(this) rhs, Forward){}

    /// 3.
    this(scope typeof(this) rhs, int i, double d, string s){}
}

void main(){
}
```

Existence of ctor 3 make dmd crash, there is some ctor overloading bug when
ctor 1. call ctor 2.

Ctor 3. must have  first parameter rvalue value of type typeof(this) to trigger
the dmd crash.

--


More information about the Digitalmars-d-bugs mailing list