D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21791 - Stack overflow for forward-referenced enum initializer
Summary: Stack overflow for forward-referenced enum initializer
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-02 19:19 UTC by moonlightsentinel
Modified: 2021-04-04 15:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description moonlightsentinel 2021-04-02 19:19:06 UTC
This code causes due to a stack overflow:

enum Foo
{
    a = Foo.init
}
Comment 1 moonlightsentinel 2021-04-02 19:37:42 UTC
(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 Dlang Bot 2021-04-04 15:06:25 UTC
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