[Issue 18289] static function and access frame

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 5 13:37:45 UTC 2023


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |INVALID

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
This is not a bug. The alias parameter can be seen as a pointer that is stored
inside the declaring struct. Since fun is static it should have no context
pointer, therefore it cannot access the alias parameter.

> Is it really expected for one case to succeed and the other to fail?

Yes, because your opCall is static and cannot access anything in B's context.
If you declare `A()` as static you will end up with the same error message.

--


More information about the Digitalmars-d-bugs mailing list