Bug 10914 – template stringof depends on instantiation order
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-27T14:28:00Z
Last change time
2015-01-06T08:40:26Z
Assigned to
nobody
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2013-08-27T14:28:19Z
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)
Comment #1 by k.hara.pg — 2015-01-06T08:40:26Z
The root was issue 7469, and it's properly fiexd in 2.066.
*** This issue has been marked as a duplicate of issue 7469 ***