[Mono-bugs] [Bug 57522][Wis] New - Smarter implicit type conversions for constants?

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 23 Apr 2004 11:43:04 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by trow@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=57522

--- shadow/57522	2004-04-23 11:43:04.000000000 -0400
+++ shadow/57522.tmp.27325	2004-04-23 11:43:04.000000000 -0400
@@ -0,0 +1,30 @@
+Bug#: 57522
+Product: Mono: Compilers
+Version: unspecified
+OS: SUSE 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: trow@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Smarter implicit type conversions for constants?
+
+Trying to compile
+
+   ulong foo = 0L;
+
+results in
+
+   error CS0031: Constant value `0' cannot be converted to ulong
+
+I don't know what the C# spec says, but is that really the correct
+behavior?  Since the value is known at compile-time, we should be able to
+know whether or not the conversion from long to ulong is safe.  In this
+case, it would be nice if the compiler silently converted 0L to 0UL.