[Mono-bugs] [Bug 25318] New - Type error on initialisers of jagged arrays

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
26 May 2002 22:21:19 -0000


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 dave-mono@earth.li.

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

--- shadow/25318	Sun May 26 18:21:19 2002
+++ shadow/25318.tmp.28121	Sun May 26 18:21:19 2002
@@ -0,0 +1,38 @@
+Bug#: 25318
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dave-mono@earth.li               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Type error on initialisers of jagged arrays
+
+Description of Problem:
+When initialising jagged arrays, the compiler tries to cast the 
+elements of a (for example) int [][] to ints, rather than the 
+int[] expected.
+
+
+Steps to reproduce the problem:
+1. int [][] jArray = { new int [] {1}};
+2. compile above line, complete example attached
+
+Actual Results:
+"error CS0029: Cannot convert implicitly from `int[]' to `int'
+
+Expected Results:
+no error
+
+Additional Information:
+The compiler happily compiles
+int [][] array = { 1 } ;
+which, unsurprisingly, gets runtime errors on access.