[Issue 23481] New: [inf loop] usertype enums opOpAssign cause an compile time infinite loop

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 13 17:19:58 UTC 2022


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

          Issue ID: 23481
           Summary: [inf loop] usertype enums opOpAssign cause an compile
                    time infinite loop
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: 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;
}
```

```
dmd --version                                            
DMD64 D Compiler v2.101.0-rc.1
```

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

there's probably a lot of these

--


More information about the Digitalmars-d-bugs mailing list