[Issue 23676] Static foreach hangs compilation for some time
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Feb 15 15:58:58 UTC 2023
    
    
  
https://issues.dlang.org/show_bug.cgi?id=23676
Dennis <dkorpel at live.nl> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel at live.nl
--- Comment #8 from Dennis <dkorpel at live.nl> ---
Reduced a bit further:
```
void f()
{
    int i;
    bool g(int I)()
    {
        static foreach(j; 0..11)
        {
            i++;
            return g!j();
        }
    }
    g!0;
}
```
The 11 is the number of enum members of Type. The amount of calls to
`checkEscapingSiblings` grows exponentially based on the loop length, which is
why compilation hangs.
--
    
    
More information about the Digitalmars-d-bugs
mailing list