[Mono-bugs] [Bug 36156][Nor] New - Wrong error in double assignment with an indexer
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
29 Dec 2002 08:42:09 -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 rpaterlini@hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=36156
--- shadow/36156 Sun Dec 29 03:42:09 2002
+++ shadow/36156.tmp.18626 Sun Dec 29 03:42:09 2002
@@ -0,0 +1,94 @@
+Bug#: 36156
+Product: Mono/MCS
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: rpaterlini@hotmail.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Wrong error in double assignment with an indexer
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+
+I have error CS0030 compiling this code:
+
+using System;
+using System.Collections;
+
+class MyData {
+ public int _i;
+ public MyData(int i) {
+ _i = i;
+ }
+}
+
+class CompilerTest {
+
+ Hashtable _hash = new Hashtable();
+
+ MyData GetMyData(int i) {
+ return new MyData(i);
+ }
+
+ public void Test(int i) {
+
+ MyData md;
+ md = (MyData)_hash[i];
+ if ( md == null ) {
+ // error CS0030: Cannot convert type 'void'
+to 'MyData'
+ md = (MyData)(_hash[i] = GetMyData(i));
+ }
+ Console.WriteLine( md._i.ToString() );
+ }
+}
+
+public class TestMain {
+ static public void Main() {
+ CompilerTest ct = new CompilerTest();
+ ct.Test(2);
+
+ }
+}
+
+
+
+
+Steps to reproduce the problem:
+1. Compile the above code
+
+Actual Results:
+Assignment.cs(25) error CS0030: Cannot convert type 'void' to 'MyData'
+
+Expected Results:
+Compilation ok.
+
+How often does this happen?
+Every time
+
+Additional Information:
+
+Changing the offending line with this code
+ MyData md2;
+ md = (MyData)(md2 = GetMyData(i));
+remove the error.
+
+The mcs compiler is checked out from cvs on december 29 and compiled on
+Windows2000.
+
+The Microsoft csc compiler compile the code.
+
+I have found this error compiling the SqlHelper.cs class in method
+GetSpParameterSet.
+This class is available here:
+http://msdn.microsoft.com/library/en-us/dnbda/html/daab-rm.asp