www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23386] New: Segfault on enum member UDA inside template


          Issue ID: 23386
           Summary: Segfault on enum member UDA inside template
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

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 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
(.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.

Oct 04 2022