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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 21 03:17:58 PST 2008


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 at digitalmars.com
        ReportedBy: samukha at 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"


-- 



More information about the Digitalmars-d-bugs mailing list