Bug 23386 – Segfault on enum member UDA inside template
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-10-04T22:03:36Z
Last change time
2022-10-05T02:05:26Z
Keywords
pull
Assigned to
No Owner
Creator
Dennis
Comments
Comment #0 by dkorpel — 2022-10-04T22:03:36Z
There's endless recursion in `syntaxCopy` of an enum member, which copies the UDA, which copies the enum member etc. So when you instantiate it in a template:
```
template E()
{
enum E : byte
{
@(1) none
}
}
alias T = E!();
```
```
2.082.1 to 2.092.1: Failure with output:
-----
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
-----
Since 2.093.1: Segfault and no output
```
Probably introduced by https://github.com/dlang/dmd/pull/11527 which made the parser add the enum member to the UDA's `decl` list.
Comment #1 by dlang-bot — 2022-10-04T22:12:37Z
@dkorpel created dlang/dmd pull request #14522 "Fix 23386 - Segfault on enum member UDA inside template" fixing this issue:
- Fix 23386 - Segfault on enum member UDA inside template
https://github.com/dlang/dmd/pull/14522
Comment #2 by dlang-bot — 2022-10-05T02:05:26Z
dlang/dmd pull request #14522 "Fix 23386 - Segfault on enum member UDA inside template" was merged into master:
- 693db705882866739186c5d223f47dab754c20a7 by Dennis Korpel:
Fix 23386 - Segfault on enum member UDA inside template
https://github.com/dlang/dmd/pull/14522