[Mono-bugs] [Bug 23540] New - Expression denotes a `value' where a `variable'/Not all code paths return a value

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
16 Apr 2002 23:49:43 -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 martin@cwanet.com.

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

--- shadow/23540	Tue Apr 16 19:49:43 2002
+++ shadow/23540.tmp.30089	Tue Apr 16 19:49:43 2002
@@ -0,0 +1,45 @@
+Bug#: 23540
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: martin@cwanet.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Expression denotes a `value' where a `variable'/Not all code paths return a value
+
+test.cs, attached below, compiles cleanly with csc (csc /target:library
+test.cs)
+but fails with mcs (mcs --target library -r System  test.cs)
+
+.\test.cs(11) error CS0118: Expression denotes a `value' where a `variable'
+was expected
+.\test.cs(3) error CS0161: Not all code paths return a value
+Error: Compilation failed
+
+using System;
+public class ClassTest{
+public static char GetChar(string Str, int Index)
+  {
+   if (Str == null)
+    throw new ArgumentException("Length of argument 'String' must be 
+greater
+than zero.", "String");
+   if (Index < 1)
+    throw new ArgumentException("Argument 'Index' must be greater than or
+equal to 1.", "Index");
+   if (Index > Str.Length)
+    throw new ArgumentException("Argument 'Index' must be less than or 
+equal
+to the length of 'String'.", "Index");
+   return Str.ToCharArray(Index -1, 1)[0];
+  }
+}