[Issue 24754] cannot take address of a member array in a ref foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 13 08:39:07 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24754

--- Comment #10 from Dominikus Dittes Scherkl <dominikus at scherkl.de> ---
(In reply to Luís Ferreira from comment #4)
> > Pointers are not allowed in @safe functions at all.
> 
> What are you talking about? They are, its specified in the spec. 20.24.1.
> Safe Functions.

Sorry.

I misread your code. And of course the compiler could allow for some more
patterns to be considered @safe, but I thought that was intentional so.

E.g. the following (a simple self-reference check) is also not considered @safe
and I was told that this is intentional without DIP1000:

```
struct Foo
{
   Foo opAssign(const ref Foo f)
   {
      if(&f == this) return this;
      ...
   }
}
```

I'm glad if this is considered a design-flaw that should be fixed.

--


More information about the Digitalmars-d-bugs mailing list