[Mono-bugs] [Bug 65573][Wis] New - MCS doesn't report CS0133 for "const char[] x = new char[] {...}"

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 8 Sep 2004 19:31:05 -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 sebastien@ximian.com.

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

--- shadow/65573	2004-09-08 19:31:05.000000000 -0400
+++ shadow/65573.tmp.5375	2004-09-08 19:31:05.000000000 -0400
@@ -0,0 +1,61 @@
+Bug#: 65573
+Product: Mono: Compilers
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sebastien@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MCS doesn't report CS0133 for "const char[] x = new char[] {...}"
+
+Description of Problem:
+MCS doesn't report CS0133 for "const char[] x = new char[] {...}".
+
+
+Steps to reproduce the problem:
+1. Compile with MCS
+
+using System;
+
+public class Program {
+	private const char[] invalidChars = new char[] { 'a', 'b' };
+
+	static void Main (string[] args)
+	{
+		Console.WriteLine ("Position {0}", args [0].IndexOfAny (invalidChars));
+	}
+}
+
+Actual Results:
+
+# mcs constarray.cs
+UNHANDLED IN bed42bb0
+ 
+Unhandled Exception: System.Exception: Does not support yet Turning array
+into a Constant
+in <0x0002a> Mono.CSharp.ArrayCreation:TurnIntoConstant ()
+in <0x00315> Mono.CSharp.Const:LookupConstantValue (object&)
+in <0x0001f> Mono.CSharp.Const:Emit ()
+in <0x0009c> Mono.CSharp.TypeContainer:EmitConstants ()
+in <0x004bc> Mono.CSharp.RootContext:EmitCode ()
+in <0x00c25> Mono.CSharp.Driver:MainDriver (string[])
+in <0x0000f> Mono.CSharp.Driver:Main (string[])
+
+
+Expected Results:
+
+$ csc constarray.cs /nologo
+constarray.cs(4,23): error CS0133: The expression being assigned to
+        'Program.invalidChars' must be constant
+
+
+How often does this happen? 
+Always