Bug 16635 – Alias this for implicit conversion to "ref const(typeof(this))" causes dmd to segfault

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-10-23T19:02:36Z
Last change time
2021-01-31T09:09:42Z
Keywords
pull
Assigned to
No Owner
Creator
Sprink

Comments

Comment #0 by sprink.noreply — 2016-10-23T19:02:36Z
This code causes it to hang indefinitely it seems. I've waited a while and it still hasn't terminated execution. Some similar code struct Vector2 { float x; float y; alias byRef this; ref const(Vector2) byRef() const { return this; } Vector2 opBinary(string op : "+")(ref const(Vector2) a) const { return Vector2(x + a.x, y + a.y); } } void main() { Vector2 a = Vector2(1, 2); Vector2 b = Vector2(3, 4); Vector2 c = a + b; // this line causes application to run infinitely Vector2 d = a + Vector2(5, 6); // this line seg faults without the above line }
Comment #1 by dlang-bot — 2021-01-27T19:51:35Z
@BorisCarvajal created dlang/dmd pull request #12161 "Fix Issue 16635 - Alias this for implicit conversion to "ref typeof(t…" fixing this issue: - Fix Issue 16635 - Alias this for implicit conversion to "ref typeof(this)" causes dmd to run endlessly https://github.com/dlang/dmd/pull/12161
Comment #2 by dlang-bot — 2021-01-31T09:09:42Z
dlang/dmd pull request #12161 "Fix Issue 16635 - Alias this for implicit conversion to "ref const(typeof(this))" causes dmd to segfault" was merged into master: - ccdd1ca11baee5174801deb41bdd5f93fbbb55a2 by Boris Carvajal: Fix Issue 16635 - Alias this for implicit conversion to "ref typeof(this)" causes dmd to run endlessly https://github.com/dlang/dmd/pull/12161