www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2465] New: Wrong .stringof value for parameter type of a templated function

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

           Summary: Wrong .stringof value for parameter type of a templated
                    function
           Product: D
           Version: 2.020
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: samukha voliacable.com


void foo(T)(T v)
{
    pragma(msg, typeof(v).stringof);
    pragma(msg, T.stringof);

    static assert(is(typeof(v) == T)); //ok
    static assert(typeof(v).stringof == T.stringof); // fails for foo(1)
}

void main()
{
    foo('a');
    foo(1);
}
----

The second foo instantiation fails because typeof(v).stringof evaluates to
"char" instead of expected "int"


-- 
Nov 21 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2465


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from clugdbug yahoo.com.au  2009-04-20 04:46 -------
Working in DMD 2.028 and 1.042. Probably fixed when 2527 was fixed?


-- 
Apr 20 2009