[Mono-bugs] [Bug 46198][Nor] New - MCS throws exception when compiling illegal struct method call
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Sat, 12 Jul 2003 11:18:32 -0400 (EDT)
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 sestoft@dina.kvl.dk.
http://bugzilla.ximian.com/show_bug.cgi?id=46198
--- shadow/46198 Sat Jul 12 11:18:32 2003
+++ shadow/46198.tmp.30428 Sat Jul 12 11:18:32 2003
@@ -0,0 +1,87 @@
+Bug#: 46198
+Product: Mono/MCS
+Version: unspecified
+OS:
+OS Details: Debian Linux
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: sestoft@dina.kvl.dk
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: MCS throws exception when compiling illegal struct method call
+
+Description of Problem:
+
+MCS 0.24.0 (from mono-0.25) throws exception when compiling illegal struct
+field assignment: the assignment
+
+(x2.IncrY()).y = 2;
+
+which is rejected by MS csc 1.1.
+
+Steps to reproduce the problem:
+1. Compile this program:
+
+using System;
+
+class MyTest {
+ public static void Main(String[] args) {
+ S x2 = new S();
+ (x2.IncrY()).y = 2;
+ }
+}
+
+struct S {
+ public int y;
+ public S IncrY() {
+ y++;
+ return this;
+ }
+}
+
+
+Actual Results:
+
+Exception caught by the compiler while compiling:
+ Block that caused the problem begin at: Bug6.cs: (8)
+ Block being compiled: [Bug6.cs: (8),Bug6.cs: (11)]
+
+Unhandled Exception: System.Exception: The Mono.CSharp.Invocation of type S
+represents a ValueType and does not implement IMemoryLocation
+in <0x0023c> 00 Mono.CSharp.FieldExpr:EmitAssign
+(Mono.CSharp.EmitContext,Mono.CSharp.Expression)
+in <0x00269> 00 Mono.CSharp.Assign:Emit (Mono.CSharp.EmitContext,bool)
+in <0x00016> 00 Mono.CSharp.Assign:EmitStatement (Mono.CSharp.EmitContext)
+in <0x00080> 00 Mono.CSharp.StatementExpression:DoEmit
+(Mono.CSharp.EmitContext)
+in <0x0002b> 00 Mono.CSharp.Statement:Emit (Mono.CSharp.EmitContext)
+in <0x00090> 00 Mono.CSharp.Block:DoEmit (Mono.CSharp.EmitContext)
+in <0x00260> 00 Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext)
+in <0x00180> 00 Mono.CSharp.EmitContext:EmitTopBlock
+(Mono.CSharp.Block,Mono.CSharp.InternalParameters,Mono.CSharp.Location)
+in <0x0028f> 00 Mono.CSharp.EmitContext:EmitTopBlock
+(Mono.CSharp.Block,Mono.CSharp.InternalParameters,Mono.CSharp.Location)
+in <0x004d8> 00 Mono.CSharp.MethodData:Emit
+(Mono.CSharp.TypeContainer,Mono.CSharp.Block,object)
+in <0x00038> 00 Mono.CSharp.Method:Emit (Mono.CSharp.TypeContainer)
+in <0x00260> 00 Mono.CSharp.TypeContainer:Emit ()
+in <0x004a4> 00 Mono.CSharp.RootContext:EmitCode ()
+in <0x0086f> 00 Mono.CSharp.Driver:MainDriver (string[])
+in <0x0001d> 00 Mono.CSharp.Driver:Main (string[])
+Expected Results:
+
+Compiler message about illegal assignment.
+
+
+How often does this happen?
+
+Always on mcs 0.24.0 and 0.23.
+
+
+Additional Information: