[Mono-bugs] [Bug 75929][Min] New - error CS0029: Cannot implicitly convert type `object' to `System.ValueType'

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Aug 29 07:06:32 EDT 2005


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 atsushi at ximian.com.

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

--- shadow/75929	2005-08-29 07:06:32.000000000 -0400
+++ shadow/75929.tmp.3736	2005-08-29 07:06:32.000000000 -0400
@@ -0,0 +1,46 @@
+Bug#: 75929
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: error CS0029: Cannot implicitly convert type `object' to `System.ValueType'
+
+mcs incorrectly rejects *explicit* cast from a value instance (e.g. int) to
+System.ValueType, saying that there is no *implicit* conversion from int to
+ValueType.
+
+using System;
+
+public class Test
+{
+        ValueType vt;
+
+        void Foo ()
+        {
+                vt = (ValueType) 1;
+        }
+}
+
+Actual Results:
+
+cast-to-valuetype.cs(9,3): error CS0029: Cannot implicitly convert type
+`object' to `System.ValueType'
+
+Expected Results:
+
+No CS0029 error.
+
+Additional Information:
+
+If there is no cast, it does not raise CS0029 error.


More information about the mono-bugs mailing list