[Mono-bugs] [Bug 78113][Nor] New - Calling static method in struct constructor

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Apr 14 13:41:34 EDT 2006


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 redforks at gmail.com.

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

--- shadow/78113	2006-04-14 13:41:34.000000000 -0400
+++ shadow/78113.tmp.21843	2006-04-14 13:41:34.000000000 -0400
@@ -0,0 +1,45 @@
+Bug#: 78113
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: redforks at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Calling static method in struct constructor
+
+gmcs will report:
+ error CS0188: The `this' object cannot be used before all of its fields 
+are assigned to
+
+Notes:
+1. struct ARec has two overload method Round, one is static one is not. It 
+seems gmcs can't distinguish overload methods.
+2. change struct to class, gmcs can work successfully. 
+
+	public struct ARec
+	{
+		decimal mVal;
+		public ARec(decimal val)
+		{
+			mVal = Round(val, 1); // error here.
+		}
+
+		decimal Round(int digits)
+		{
+			return Round(mVal, digits);
+		}
+
+		static decimal Round(decimal val, int digits)
+		{
+			return 0;
+		}
+	}


More information about the mono-bugs mailing list