[Issue 10914] New: template stringof depends on instantiation order

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 27 14:28:20 PDT 2013


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 at puremagic.com
        ReportedBy: monarchdodra at gmail.com


--- Comment #0 from monarchdodra at gmail.com 2013-08-27 14:28:19 PDT ---
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: -------


More information about the Digitalmars-d-bugs mailing list