D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2057 - Unexpected type names with template typedefs
Summary: Unexpected type names with template typedefs
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2008-04-29 11:33 UTC by Simen Kjaeraas
Modified: 2019-07-29 07:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Simen Kjaeraas 2008-04-29 11:33:08 UTC
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 Don 2012-11-12 07:25:52 UTC
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'
}