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;
}