digitalmars.D.bugs - [Issue 1620] New: std.conv.to fails for integer unsigned->signed conversion
- d-bugmail puremagic.com (30/30) Oct 28 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1620
- d-bugmail puremagic.com (4/4) Mar 01 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1620
- d-bugmail puremagic.com (9/9) Mar 01 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1620
- d-bugmail puremagic.com (9/9) Mar 06 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1620
http://d.puremagic.com/issues/show_bug.cgi?id=1620 Summary: std.conv.to fails for integer unsigned->signed conversion Product: D Version: 2.006 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: i.kasiuk gmx.de A conversion like to!(int)(123u) fails, producing the following error at runtime: Error: Error: overflow Conversion underflow Here is the code from conv.d which does the check: static const sSmallest = isFloatingPoint!(S) ? -S.max : S.min, tSmallest = isFloatingPoint!(T) ? -T.max : T.min; static if (sSmallest < tSmallest) { // possible underflow if (value < tSmallest) conv_overflow("Conversion underflow"); } ... This apparently doesn't work as intended because of the implicit conversions happening when the values are compared. Actually, why does the compiler silently do an implicit type conversion here? I think this is a bit unfortunate. --
Oct 28 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1620 ------- Comment #1 from i.kasiuk gmx.de 2008-03-01 12:31 ------- The bug is still present in version 2.011. --
Mar 01 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1620 andrei metalanguage.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bugzilla digitalmars.com |andrei metalanguage.com ------- Comment #2 from andrei metalanguage.com 2008-03-01 17:40 ------- I actually fixed this in my tree. The fix will be part of the next release. Thanks! --
Mar 01 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1620 andrei metalanguage.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #3 from andrei metalanguage.com 2008-03-07 00:38 ------- Fixed in 2.012. --
Mar 06 2008