www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10914] New: template stringof depends on instantiation order

http://d.puremagic.com/issues/show_bug.cgi?id=10914

           Summary: template stringof depends on instantiation order
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com



First, you start by creating some templated class, and then, you add an
templated alias to it:

//----
struct FooImpl(size_t A)
{}

template Foo(size_t A)
{
    alias FooImpl!(A) Foo;
}
//----

From there, the idea is to test "stringof":

DMD 2.0.64 alpha:
//----
pragma(msg, Foo!(1).stringof);
pragma(msg, FooImpl!(1).stringof);
//----
FooImpl!(1LU)
FooImpl!(1LU)
//----

But now, if you invert the pragma order...
//----
pragma(msg, FooImpl!(1).stringof);
pragma(msg, Foo!(1).stringof);
//----
FooImpl!1
FooImpl!1
//----

Why "1" in one case, and "1UL" in another???

With gdc, I get:
//----
pragma(msg, FooImpl!(1).stringof);
pragma(msg, Foo!(1).stringof);
//----
struct FooImpl
FooImpl!(A)
//----

Changing the order just changes the output for gdc (nothing special happens)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 27 2013