Bug 23481 – [inf loop] usertype enums opOpAssign cause an compile time infinite loop
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-11-13T17:19:58Z
Last change time
2022-12-15T22:49:58Z
Keywords
pull
Assigned to
No Owner
Creator
crazymonkyyy
Comments
Comment #0 by crazymonkyyy — 2022-11-13T17:19:58Z
```
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
Comment #1 by dlang-bot — 2022-12-12T02:26:58Z
@BorisCarvajal created dlang/dmd pull request #14684 "Fix Issue 23481 - [inf loop] usertype enums opOpAssign cause an compile time infinite loop" fixing this issue:
- Fix Issue 23481 - [inf loop] usertype enums opOpAssign cause an compile time infinite loop
https://github.com/dlang/dmd/pull/14684
Comment #2 by dlang-bot — 2022-12-15T03:11:11Z
dlang/dmd pull request #14684 "Fix Issue 23481 - [inf loop] usertype enums opOpAssign cause an compile time infinite loop" was merged into stable:
- 2328cd7e6331ecd0e0bc391ec56db256ccaed382 by Boris Carvajal:
Fix Issue 23481 - [inf loop] usertype enums opOpAssign cause an compile time infinite loop
https://github.com/dlang/dmd/pull/14684
Comment #3 by dlang-bot — 2022-12-15T22:49:58Z
dlang/dmd pull request #14701 "merge stable" was merged into master:
- 0a5b39e6e08885d9f11b385e2edb1ecac7418704 by Boris Carvajal:
Fix Issue 23481 - [inf loop] usertype enums opOpAssign cause an compile time infinite loop
https://github.com/dlang/dmd/pull/14701