[Issue 23753] this allowed in static member function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 1 11:37:49 UTC 2023


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
It seems that this is done intentionally [1], although I couldn't find anything
in the spec. It seems that all compilers on run.dlang.io run this successfully.

Is there a strong argument to not allow this (and justify the breakage) or
should we simply amend the spec?

I, personally, don't see any harm in allowing it. Note that this only works
because you are using sizeof (which is instance agnostic). Any other uses of
the concrete member will result in an error. 

[1]
https://github.com/dlang/dmd/blob/master/compiler/src/dmd/expressionsem.d#L12735

--


More information about the Digitalmars-d-bugs mailing list