[Mono-bugs] [Bug 72930][Cos] Changed - CS0133 not reported for const fields of type object

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 24 Feb 2005 03:54:16 -0500 (EST)


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 rharinath@novell.com.

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

--- shadow/72930	2005-02-23 15:08:39.000000000 -0500
+++ shadow/72930.tmp.30665	2005-02-24 03:54:16.000000000 -0500
@@ -10,13 +10,13 @@
 Component: C#
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: nazgul@omega.pl               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
-Cc: 
+Cc: miguel@ximian.com,rharinath@novell.com
 Summary: CS0133 not reported for const fields of type object
 
 Please fill in this template when reporting a bug, unless you know what you
 are doing.
 Description of Problem:
 CS0133 should be reported when constant field of type object is being
@@ -94,6 +94,24 @@
 ------- Additional Comments From nazgul@omega.pl  2005-02-23 15:08 -------
 Sorry, the expected result is
 t.cs(3,35): error CS0133: The expression being assigned to 'Test.x'
 must be constant
 
 not the one mentioned earlier
+
+------- Additional Comments From rharinath@novell.com  2005-02-24 03:54 -------
+Hmm...  I feel the standard is not very clear on this.
+
+According to the Sec. 17.3, the constant can be initialized by an
+implicit conversion from the constant-expression.  That includes
+implicit reference conversions and boxing conversions, and so, the
+code should theoretically be allowed.  Even if it said "implicit
+standard conversion".
+
+The only suggestion of the intent is the _non-normative_ note which
+says that a non-null reference can only be obtained by a "new", which
+is disallowed for a a constant-expression.  But: both reference
+conversions and boxing can generate non-null references from the
+constant-expression.
+
+Probably requires a clarification.
+