[Mono-bugs] [Bug 70140][Maj] New - Constructor base initialiser using out parameter causes compiler exception

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 2 Dec 2004 11:28:48 -0500 (EST)

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 sgroot@liacs.nl.


--- shadow/70140	2004-12-02 11:28:48.000000000 -0500
+++ shadow/70140.tmp.9409	2004-12-02 11:28:48.000000000 -0500
@@ -0,0 +1,84 @@
+Bug#: 70140
+Product: Mono: Compilers
+Version: 1.1
+OS Details: Fedora Core 3
+Status: NEW   
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sgroot@liacs.nl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Constructor base initialiser using out parameter causes compiler exception
+Description of Problem:
+Consider the following C# code:
+public class test
+  public test(out bool hello)
+  {
+    hello = true;
+  }
+public class testchild : test {
+  public testchild(out bool hello) : base(out hello)
+  {
+  }
+---END CODE---
+This is valid C# code and compiles with the Microsoft C# compiler. The Mono
+C# compiler however generates an exception when presented with this code.
+The following exception occurs:
+Unhandled Exception: System.Exception: Variables have not been initialized yet
+in <0x00043> Mono.CSharp.Block:get_ParameterMap ()
+in <0x00065> Mono.CSharp.ParameterReference:DoResolveBase
+in <0x0001f> Mono.CSharp.ParameterReference:DoResolveLValue
+in <0x00028> Mono.CSharp.Expression:ResolveLValue
+in <0x0011e> Mono.CSharp.SimpleName:DoSimpleNameResolve
+in <0x00030> Mono.CSharp.SimpleName:SimpleNameResolve
+in <0x00022> Mono.CSharp.SimpleName:DoResolveLValue
+in <0x00028> Mono.CSharp.Expression:ResolveLValue
+in <0x00176> Mono.CSharp.Argument:Resolve
+in <0x000eb> Mono.CSharp.ConstructorInitializer:Resolve
+in <0x001f4> Mono.CSharp.Constructor:Emit ()
+in <0x00442> Mono.CSharp.TypeContainer:EmitType ()
+in <0x004a4> Mono.CSharp.RootContext:EmitCode ()
+in <0x00cff> Mono.CSharp.Driver:MainDriver (string[])
+in <0x00019> Mono.CSharp.Driver:Main (string[])
+This has been observed in 1.0.4 and 1.1.2, although the message differed
+(in 1.0.4 is just said "A System.Exception has been thrown.")
+The problem does not occur with ref parameters.
+Steps to reproduce the problem:
+1. Create a source file called test.cs which contains the code listed above
+2. Compile the source file using the command 'mcs test.cs'
+Actual Results:
+The exception specified above is shown.
+Expected Results:
+If the compiler is presented with just the source above, it should complain
+no entry point is present. In a more complete example, or with -t:library,
+it should compile correctly.
+How often does this happen?