Bug 15527 – Template instantiation uses same-name symbol from different scope as template alias parameter
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-01-07T23:04:00Z
Last change time
2016-03-18T12:35:54Z
Assigned to
nobody
Creator
adrian
Comments
Comment #0 by adrian — 2016-01-07T23:04:01Z
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.
Comment #1 by ketmar — 2016-01-09T19:10:03Z
i bet i've seen this bug reported already. sorry, can't find it — my search-foo sux.
Comment #2 by k.hara.pg — 2016-03-18T12:35:54Z
*** This issue has been marked as a duplicate of issue 13617 ***