Thread overview
[Issue 1883] New: templates instantiated as real gives incorrect values
Feb 29, 2008
d-bugmail
Mar 01, 2008
d-bugmail
Mar 07, 2008
d-bugmail
Mar 07, 2008
d-bugmail
February 29, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1883

           Summary: templates instantiated as real gives incorrect values
           Product: D
           Version: 2.011
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: diboss@hotmail.com


Here's a simplified example:

template factorial(real n) {
     const real factorial = 1;
}

void main() {
     writefln(factorial!(5));
}

outputs: -0 instead of 1.
This is different than behaviour in 1.027.


-- 

March 01, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1883





------- Comment #1 from bugzilla@digitalmars.com  2008-03-01 14:14 -------
This is actually a bug in writefln().


-- 

March 07, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1883


andrei@metalanguage.com changed:

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




------- Comment #2 from andrei@metalanguage.com  2008-03-07 00:30 -------
Fixed in 2.012.


-- 

March 07, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1883





------- Comment #3 from bugzilla@digitalmars.com  2008-03-07 00:39 -------
Fixed dmd 2.012


--