Bug 1883 – templates instantiated as real gives incorrect values

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P5
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2008-02-29T09:18:00Z
Last change time
2015-06-09T01:14:35Z
Assigned to
andrei
Creator
diboss

Comments

Comment #0 by diboss — 2008-02-29T09:18:46Z
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.
Comment #1 by bugzilla — 2008-03-01T14:14:29Z
This is actually a bug in writefln().
Comment #2 by andrei — 2008-03-07T00:30:13Z
Fixed in 2.012.
Comment #3 by bugzilla — 2008-03-07T00:39:32Z
Fixed dmd 2.012