September 01, 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@digitalmars.com
        ReportedBy: reiner.pope@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


-- 

September 01, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1465


deewiant@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




------- Comment #1 from deewiant@gmail.com  2007-09-01 03:49 -------


*** This bug has been marked as a duplicate of 1168 ***


--