[Mono-bugs] [Bug 47161][Nor] New - mcs does not catch assigment to readonly variable
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Wed, 30 Jul 2003 23:57:30 -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 jluke@cfl.rr.com.
http://bugzilla.ximian.com/show_bug.cgi?id=47161
--- shadow/47161 Wed Jul 30 23:57:29 2003
+++ shadow/47161.tmp.8437 Wed Jul 30 23:57:30 2003
@@ -0,0 +1,57 @@
+Bug#: 47161
+Product: Mono/MCS
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: jluke@cfl.rr.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mcs does not catch assigment to readonly variable
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem: mcs does not catch that you are making an
+assignment to a readonly variable, yet that variable's value has not changed
+
+
+Steps to reproduce the problem:
+1. compile and run:
+
+using System;
+
+class T
+{
+ static readonly string test;
+
+ static void Main ()
+ {
+ new T ();
+ }
+
+ T ()
+ {
+ test = "blah";
+ Console.WriteLine (test);
+ }
+}
+
+Actual Results:
+blank line is printed
+
+Expected Results:
+error CS0198: A static readonly field cannot be assigned to (except in a
+static constructor or a variable initializer)
+
+How often does this happen?
+always
+
+Additional Information:
+it is caught if the assignment is not in a constructor