www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22997] New: DMD crash: copy ctor can't call other ctor


          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 puremagic.com
          Reporter: submada gmail.com

Hello, this code crash dmd:

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.

Apr 08 2022