[Issue 23117] crash in @safe code after CTFE
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue May 17 10:28:50 UTC 2022
    
    
  
https://issues.dlang.org/show_bug.cgi?id=23117
Dennis <dkorpel at live.nl> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel at live.nl
--- Comment #1 from Dennis <dkorpel at live.nl> ---
Reduced to remove Phobos imports:
```
@safe:
auto crash = foo([10]);
void main()
{
    assert(crash.front.front == 10);
}
struct Map(alias f)
{
    int[] range;
    auto front() { return f(range[0]); }
}
struct Enumerate
{
    int[] range;
    int front() { return range[0]; }
}
auto foo(int[] r)
{
    return Map!(x => Enumerate(r))(r);
}
```
--
    
    
More information about the Digitalmars-d-bugs
mailing list