[Issue 24754] cannot take address of a member array in a ref foreach
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Thu Sep 12 22:40:00 UTC 2024
    
    
  
https://issues.dlang.org/show_bug.cgi?id=24754
--- Comment #7 from Luís Ferreira <contact at lsferreira.net> ---
Funny enough, if you compile the initial code snippet with `-vcg-ast` (that
yields incorrect D code, but you can understand how it converts it to), it
pretty much converts it to something compatible like this, which is compilable:
```
struct Foo
{
        int[] foo;
        void foobar()
        {
                int* f = null;
                {
                        int[] __r2 = this.foo[];
                        ulong __key3 = 0LU;
                        for (; __key3 < __r2.length; __key3 += 1LU)
                        {
                                int* e = &__r2[__key3];
                                f = e;
                        }
                }
        }
}
```
--
    
    
More information about the Digitalmars-d-bugs
mailing list