[Mono-bugs] [Bug 26974][Nor] New - Badly typed struct constructor invocations cause call to default ctr instead of compiler error

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
25 Jun 2002 20:05:06 -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 adb@tardis.ed.ac.uk.

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

--- shadow/26974	Tue Jun 25 16:05:06 2002
+++ shadow/26974.tmp.2822	Tue Jun 25 16:05:06 2002
@@ -0,0 +1,44 @@
+Bug#: 26974
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: adb@tardis.ed.ac.uk                            
+ReportedBy: adb@tardis.ed.ac.uk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Badly typed struct constructor invocations cause call to default ctr instead of compiler error
+
+Description of Problem:
+
+If you invoke a struct constructor with the wrong parameters, the default
+constructor ends up getting called.  This shouldn't even compile.
+
+Steps to reproduce the problem:
+
+public struct Test {
+	public Test(int i) { }
+        public static void Main() {
+                Test t = new Test("foo");
+        }
+}
+
+Actual Results:
+
+Program compiles, call to Test("foo") invokes default constructor.
+
+Expected Results:
+
+Should fail with 'no constructor matches argument list' error.
+
+Additional Information:
+
+This only affects structs, not classes.  I have a one-line patch which I'm
+testing.