Using static properties and methods of variable in its own initializer
Dave P.
dave287091 at gmail.com
Thu Apr 10 14:37:36 UTC 2025
On Thursday, 10 April 2025 at 10:39:43 UTC, user1234 wrote:
> On Wednesday, 9 April 2025 at 19:47:43 UTC, Dave P. wrote:
>> [...]
>> Should this be fixed? or is this the intended design of the
>> language?
>
> 1. I think that the pattern should never be accepted, so the
> very first example, the one at the global scope, must be an
> error.
> 2. There's no shadowing as long as you can disambiguate, using
> a qual chain (or even the global scope operator), the right
> decl. to use.
>
> Let's look at the other proglangs... C is permissive, C++ is
> not (unless -fpermissive).
>
> - C : https://godbolt.org/z/PeW8G75cM
> - C++: https://godbolt.org/z/onsczY459
I don’t know what you’re trying to show with your godbolt links.
C++ allows what I am talking about, those errors are due to it
disallowing implicit conversions from `void*`, which D also
disallows.
More information about the Digitalmars-d
mailing list