digitalmars.D.bugs - [Issue 15488] New: global variable shadows function argument
- via Digitalmars-d-bugs (33/33) Dec 31 2015 https://issues.dlang.org/show_bug.cgi?id=15488
https://issues.dlang.org/show_bug.cgi?id=15488 Issue ID: 15488 Summary: global variable shadows function argument Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: or weka.io abc.d: module abc; int global_x = 0; main.d: void foo(int global_x) { import std.stdio; writefln("Address of func argument: %x", &global_x); import abc; writefln("Address of func argument: %x", &global_x); } void main() { foo(5); } running: rdmd main.d Address of func argument: 7fff56108688 Address of func argument: 7fb0c9c04c70 If I move the import outside of 'foo' the function argument silently shadows the global variable, which seems fine to me. --
Dec 31 2015