Bug 23861 – Compiler segmentation fault with ref and alias this

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-04-26T01:03:48Z
Last change time
2023-04-26T13:15:54Z
Keywords
ice-on-invalid-code, pull
Assigned to
No Owner
Creator
zach-dmd

Comments

Comment #0 by zach-dmd — 2023-04-26T01:03:48Z
Attempting to compile the following code with DMD v2.103.0 causes a segmentation fault in DMD: ``` Foo global; struct Foo { ref Foo get() { return global; } alias get this; } void main() { Foo g; g = 3; } ```
Comment #1 by razvan.nitu1305 — 2023-04-26T08:05:46Z
Most likely this runs into a stack overflow due to the repeated expansion of alias this.
Comment #2 by dlang-bot — 2023-04-26T11:42:32Z
@RazvanN7 created dlang/dmd pull request #15133 "Fix Issue 23861 - Compiler segmentation fault with ref and alias this" fixing this issue: - Fix Issue 23861 - Compiler segmentation fault with ref and alias this https://github.com/dlang/dmd/pull/15133
Comment #3 by dlang-bot — 2023-04-26T13:15:54Z
dlang/dmd pull request #15133 "Fix Issue 23861 - Compiler segmentation fault with ref and alias this" was merged into master: - 575e8f9243fdb100b66302906c02b36ead11e34a by RazvanN7: Fix Issue 23861 - Compiler segmentation fault with ref and alias this https://github.com/dlang/dmd/pull/15133