Bug 23403 – Segfault when calling auto-generated struct constuctor with __FUNCTION__ or __PRETTY_FUNCTION__

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-10-10T15:16:29Z
Last change time
2024-06-24T12:12:02Z
Keywords
pull
Assigned to
No Owner
Creator
Andrej Mitrovic

Comments

Comment #0 by andrej.mitrovich — 2022-10-10T15:16:29Z
----- struct Context { string pretty_function; } void test(Context ctx = Context(__FUNCTION__)) { } void main() { test(); } ----- > $ dmd test.d > [test.d(6)] __FUNCTION__: __FUNCTION__ > [1] 1000 illegal hardware instruction (core dumped) dmd test.d Also reproducible with __PRETTY_FUNCTION__. Note that it works OK if `Context` has a hand-written ctor taking a string.
Comment #1 by dlang-bot — 2022-10-12T10:47:46Z
@RazvanN7 created dlang/dmd pull request #14549 "Fix Issues 23408 and 23403 - __FUNCTION__ does not resolve properly" fixing this issue: - Fix Issues 23408 and 23403 - __FUNCTION__ does not resolve properly https://github.com/dlang/dmd/pull/14549
Comment #2 by razvan.nitu1305 — 2024-06-24T12:12:02Z