Bug 3239 – std.conv.roundTo does not accept const/immutable/shared

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2009-08-10T02:29:00Z
Last change time
2015-06-09T01:28:05Z
Keywords
rejects-valid
Assigned to
andrei
Creator
hskwk

Comments

Comment #0 by hskwk — 2009-08-10T02:29:21Z
std.conv.roundTo does not accept const/immutable/shared for its Source. These attributes won't pass static asserts in std.conv.roundTo. e.g.: immutable real a = -2.3; int b = roundTo!(int)(a); // failure int c = cast(int)std.math.round(a); // success It seems that static asserts in std.conv.roundTo should be replaced by std.traits.isIntegral and std.traits.isFloatingPoint. p.s. I suppose roundTo is able to be pure function.
Comment #1 by andrei — 2009-08-28T11:05:42Z
Fixed. Purity is pending issue 3269.