[Issue 23551] Error messages for use of array literals in @nogc code should be improved`
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Dec 12 18:32:46 UTC 2022
    
    
  
https://issues.dlang.org/show_bug.cgi?id=23551
Grim Maple <grimmaple95 at gmail.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |grimmaple95 at gmail.com
--- Comment #3 from Grim Maple <grimmaple95 at gmail.com> ---
(In reply to Dennis from comment #2)
> What is the expected message?
The error itself targets this line
```
auto b = x[0..1];
```
which isn't what causes the issue. It's this line
```
enum x = [1,4];
```
which prevents slicing from being @nogc compatible. If changed to static
immutable x = [1,4]; code compiles fine
--
    
    
More information about the Digitalmars-d-bugs
mailing list