Bug 21791 – Stack overflow for forward-referenced enum initializer
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-04-02T19:19:06Z
Last change time
2021-04-04T15:06:25Z
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2021-04-02T19:19:06Z
This code causes due to a stack overflow:
enum Foo
{
a = Foo.init
}
Comment #1 by moonlightsentinel — 2021-04-02T19:37:42Z
(In reply to moonlightsentinel from comment #0)
> This code causes due to a stack overflow:
*This code causes dmd to crash due to a stack overflow:
Comment #2 by dlang-bot — 2021-04-04T15:06:25Z
dlang/dmd pull request #12346 "Fix 21791 - Stack overflow for forward-referenced enum initializer" was merged into master:
- f45c5b98400be67f16fbf9210c761bbff492bb5d by MoonlightSentinel:
Fix 21791 - Stack overflow for forward-referenced enum initializer
Ensure that semantic for the `EnumMember` chosen as a `.init` was already
done.
The previous check was never hit because `sematicRun` is changed before
analyzing the enum body.
https://github.com/dlang/dmd/pull/12346