Bugzilla – Bug 321154
[GMCS] Nullable conversions
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by adrinael@adrinael.net 2006-05-16 07:51:28 MST ---- Description of Problem: The following little code snippet object d; object q; ... q = (double?)((decimal) d); produces an error "cannot convert from decimal to double?" on gmcs, csc compiles it. From the standard: "For these reasons, no implicit conversions exist between the floating point types and decimal" " -- an implicit conversion exists from any non-nullable value type to a nullable form of that type" Strictly said, that makes (double?)decimalvalue an error _if_ the conversion needs to convert to double first. gmcs seems to be correct, this is only a "differs from csc" bugreport. ---- Additional Comments From rharinath@novell.com 2006-06-15 07:28:50 MST ---- Hmm, not really. If there's an explicit conversion from S to T, there's an explicit nullable conversion from S to T? (Section 13.7.2 Nullable conversions) So, a decimal -> double? explicit nullable conversion exists, which is defined in terms of double -> decimal (explicit conversion) decimal -> decimal? (wrapping) ---- Additional Comments From martin@ximian.com 2006-06-19 18:58:11 MST ---- Fixed in SVN. Unknown operating system unknown. Setting to default OS "Other".