Shadowing of module global TLS variables is not an error
Nils Lankila
NilsLankila at gmx.us
Fri Aug 14 09:45:26 UTC 2020
On Friday, 14 August 2020 at 08:58:04 UTC, Per Nordlöw wrote:
> Shouldn't this code give a shadowing error?
>
> int x; // global?
>
> void test() @safe nothrow @nogc
> {
> int x = x; // shouldn't this give a
> shadowing warning?
> }
Why should it ? they are not declared in the same scope so
resoltuion rules work perfectly, you distinguish both in several
ways. The global using `modulename.x` or `.x` and just `x` in the
func body to use the local one.
More information about the Digitalmars-d
mailing list