Bug 2057 – Unexpected type names with template typedefs

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-04-29T11:33:08Z
Last change time
2019-07-29T07:46:39Z
Keywords
wrong-code
Assigned to
No Owner
Creator
Simen Kjaeraas

Comments

Comment #0 by simen.kjaras — 2008-04-29T11:33:08Z
struct foo(T) { T value; } template bar(T) { typedef foo!(T) bar; } void main(string[] args) { writefln((bar!(int)).stringof); // prints 'bar' writefln((bar!(float)).stringof); // also prints 'bar' } Seeing as these two are different instantiations of the bar template, it seems weird to me that they have the same type name. The typedef maps to bar!(something), hence should the name as well.
Comment #1 by clugdbug — 2012-11-12T07:25:52Z
Though marked as a D2-only bug, it's actually D1 only! struct foo(T) { T value; } template bar(T) { typedef foo!(T) bar; } void main() { pragma(msg, (bar!(int)).stringof); // prints 'bar' pragma(msg, (bar!(float)).stringof); // also prints 'bar' }