[Issue 11521] Collision of templates instantiated with different same-named locals
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jul 20 21:33:04 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=11521
Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Summary|Switch using same name |Collision of templates
|variable leads to Access |instantiated with different
|Violation |same-named locals
Severity|normal |critical
--- Comment #1 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
Reduced:
////// test.d /////
void fun(alias x)()
{
assert(x == 1);
}
void main()
{
if (false)
{
int i = 0;
fun!i();
}
{
int i = 1;
fun!i();
}
}
///////////////////
The problem is that both fun!i instantiations have the same mangled name, even
though they refer to different variables and have different code.
The mangled name of local variables should have some sort of index in them.
--
More information about the Digitalmars-d-bugs
mailing list