Re: template ctor overload Segmentation fault

2021-12-14 Thread vit via Digitalmars-d-learn
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{

Re: template ctor overload Segmentation fault

2021-12-14 Thread RazvanN via Digitalmars-d-learn
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

Re: template ctor overload Segmentation fault

2021-12-14 Thread RazvanN via Digitalmars-d-learn
On Tuesday, 14 December 2021 at 13:02:16 UTC, Tejas wrote: On Tuesday, 14 December 2021 at 12:04:36 UTC, RazvanN wrote: [...] Then why did my modification work? ```d struct Foo(T){ this(Rhs, this This)(scope Rhs rhs){ } this(scope Foo!(T)* rhs){ //replaced typeof(this) with Foo!

Re: template ctor overload Segmentation fault

2021-12-14 Thread Tejas via Digitalmars-d-learn
On Tuesday, 14 December 2021 at 12:04:36 UTC, RazvanN wrote: On Sunday, 12 December 2021 at 11:57:43 UTC, vit wrote: [...] The problem is that the compiler will try to generate an inout copy constructor for Bar that looks roughly like this: ``` this(ref scope inout(Bar) p) inout { this.

Re: template ctor overload Segmentation fault

2021-12-14 Thread RazvanN via Digitalmars-d-learn
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

Re: template ctor overload Segmentation fault

2021-12-13 Thread Tejas via Digitalmars-d-learn
On Sunday, 12 December 2021 at 19:17:53 UTC, vit wrote: On Sunday, 12 December 2021 at 18:32:28 UTC, Imperatorn 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

Re: template ctor overload Segmentation fault

2021-12-13 Thread user1234 via Digitalmars-d-learn
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

Re: template ctor overload Segmentation fault

2021-12-12 Thread vit via Digitalmars-d-learn
On Sunday, 12 December 2021 at 18:32:28 UTC, Imperatorn 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{

Re: template ctor overload Segmentation fault

2021-12-12 Thread Imperatorn via Digitalmars-d-learn
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