www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2057] New: Unexpected type names with template typedefs

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2057

           Summary: Unexpected type names with template typedefs
           Product: D
           Version: 2.014
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: simen.kjaras gmail.com


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.


-- 
Apr 29 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2057


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.014                       |D1


--- Comment #1 from Don <clugdbug yahoo.com.au> 2012-11-12 07:25:52 PST ---
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'
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012