www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23406] New: [seg fault] enums can cause compile time seg

https://issues.dlang.org/show_bug.cgi?id=23406

          Issue ID: 23406
           Summary: [seg fault] enums can cause compile time seg faults
                    with assignments
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: crazymonkyyy gmail.com

```
struct flagenum{
        int i=1;alias i this;
        auto opBinary(string s)(int j){
                assert(j==1);
                return typeof(this)(i*2);
        }
        auto opEquals(int a){
                return false;
        }
}
enum alphakey{a=flagenum(),b,c,d,e,f,g,h,i//,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
}
alphakey alpha;
void main(){
        alpha=0;
}
```

[1]    52237 segmentation fault (core dumped)  dmd segfualt.d
I find that a 9th member causes the seg fault sus; but its the cut off point --
Oct 11 2022