[Issue 15527] New: Template instantiation uses same-name symbol from different scope as template alias parameter
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jan 7 15:04:01 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15527
Issue ID: 15527
Summary: Template instantiation uses same-name symbol from
different scope as template alias parameter
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: epi at atari8.info
Code (test.d):
struct Foo(alias Bar) {
pragma(msg, typeof(Bar));
}
struct Baz {}
struct Quux {}
void main()
{
{
auto b = Baz();
Foo!b foo1;
}
{
auto r = Quux();
Foo!r foo2;
}
}
$ dmd test.d
Baz
Quux
All good, there are two distinct instantiations.
However, if the variable in the second scope is renamed to b:
{
auto b = Baz();
Foo!b foo1;
}
{
auto b = Quux();
Foo!b foo2;
}
$ dmd test.d
Baz
Foo is not instantiated again with the other b of type Quux.
--
More information about the Digitalmars-d-bugs
mailing list