template ctor overload Segmentation fault
vit
vit at vit.vit
Tue Dec 14 20:56:57 UTC 2021
On Tuesday, 14 December 2021 at 14:40:00 UTC, RazvanN wrote:
> On Sunday, 12 December 2021 at 11:57:43 UTC, vit wrote:
>> Hello, why does this code fail to compile?
>>
>> ```d
>> struct Foo(T){
>> this(Rhs, this This)(scope Rhs rhs){
>> }
>>
>> this(ref scope typeof(this) rhs){
>> }
>> }
>>
>>
>> struct Bar{
>> Foo!int foo;
>> }
>>
>> void main(){
>> }
>> ```
>>
>> error: Segmentation fault (core dumped)
>
> PR: https://github.com/dlang/dmd/pull/13427
Thanks,
I got it to work for now:
```d
struct Foo(T){
this(Rhs, this This)(auto ref scope Rhs rhs)
if(__traits(isRef, rhs) == false){
}
this(ref scope typeof(this) rhs){
}
}
struct Bar{
Foo!int foo;
}
void main(){
}
```
More information about the Digitalmars-d-learn
mailing list