[Issue 23406] [seg fault] enums can cause compile time seg faults with assignments using alias this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 12 16:50:22 UTC 2022


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

--- Comment #3 from crazymonkyyy at gmail.com ---
```
struct flagenum(I=ubyte){
        I i=1; alias i this;
        auto opBinary(string s)(int j){
                assert(j==1);
                return typeof(this)(cast(I)(i*2));
        }
        auto opEquals(I a){
                return false;
        }
}
enum
alphakey{a=flagenum!int(),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
}
flagenum!int alpha;
void main(){
        alpha&=alphakey.a;
}
```

causes the compiler to consume all computer resources

is this the same bug?

--


More information about the Digitalmars-d-bugs mailing list