[Issue 1465] New: Value of x.stringof changes when used as a template parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 1 01:39:58 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1465
Summary: Value of x.stringof changes when used as a template
parameter
Product: D
Version: 2.003
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: reiner.pope at gmail.com
The following code, when compiling, prints "x" then "int". It should print "x"
both times.
template Print(string B)
{
pragma(msg, B);
}
int x;
pragma(msg, x.stringof);
alias Print!(x.stringof) s;
Assigning x.stringof to a compile-time constant string fixes it, eg
const text = x.stringof;
pragma(msg, text); // prints x
alias Print!(x.stringof) p; // prints x
--
More information about the Digitalmars-d-bugs
mailing list