Bug 22997 – DMD crash: copy ctor can't call other ctor

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-04-08T15:11:16Z
Last change time
2022-04-13T08:31:10Z
Keywords
pull
Assigned to
No Owner
Creator
vitamin

Comments

Comment #0 by submada — 2022-04-08T15:11:16Z
Hello, this code crash dmd: ```d 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.
Comment #1 by moonlightsentinel — 2022-04-08T16:48:50Z
git bisect blames commit db885735557357c6a2886d6384459cbe3ae66056 included in https://github.com/dlang/dmd/pull/8688
Comment #2 by dlang-bot — 2022-04-12T11:21:07Z
@RazvanN7 created dlang/dmd pull request #13976 "Fix Issue 22997 - DMD crash: copy ctor can't call other ctor" fixing this issue: - Fix Issue 22997 - DMD crash: copy ctor can't call other ctor https://github.com/dlang/dmd/pull/13976
Comment #3 by dlang-bot — 2022-04-13T08:31:10Z
dlang/dmd pull request #13976 "Fix Issue 22997 - DMD crash: copy ctor can't call other ctor" was merged into master: - 780c5dcdf66e5f2626e9991423c05cb5f77f5095 by RazvanN7: Fix Issue 22997 - DMD crash: copy ctor can't call other ctor https://github.com/dlang/dmd/pull/13976