[Issue 21613] New: DMD crash: copy ctor + templated rvalue ctor
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sat Feb  6 07:42:45 UTC 2021
    
    
  
https://issues.dlang.org/show_bug.cgi?id=21613
          Issue ID: 21613
           Summary: DMD crash: copy ctor + templated rvalue ctor
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: submada at gmail.com
compiler version: DMD v2.095.0
1. This code print error (that is OK):
struct Test{   /////Error: struct Test may not define both a rvalue constructor
and a copy constructor
    this(ref const typeof(this) rhs){
    }
    this(const typeof(this) rhs){   
    }
}
void main(){
    const Test cb;
    Test b = cb;
}
2. This code crash DMD:
struct Test{  
    this(ref const typeof(this) rhs){
    }
    this()(const typeof(this) rhs){   ///<-- rvalue ctor is template
    }
}
void main(){
    const Test cb;
    Test b = cb;
}
--
    
    
More information about the Digitalmars-d-bugs
mailing list