[Mono-bugs] [Bug 444673] New: error compiling nested anonymous delegates in generic class
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Nov 13 10:40:51 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=444673
Summary: error compiling nested anonymous delegates in generic
class
Product: Mono: Compilers
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: daniel at hofmannmail.ath.cx
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Compiling the following piece of code with gmcs results in a compiler
exception, while csc has no complaints.
class SomeGenericClass<SomeType> {
object someValue;
delegate void SomeHandlerType ();
void Invoke (SomeHandlerType h) {}
public void FailsToCompile () {
Invoke(delegate {
object someObject = 1;
Invoke (delegate {
someValue = someObject;
});
});
}
}
The exception:
dani at kaplan:/home/dani_nobkup/tmp/swfplayground > gmcs gmcsbug.cs
-target:library
Exception caught by the compiler while emitting:
Block that caused the problem begin at: gmcsbug.cs(6,25):
System.InvalidOperationException: can only be called in generic type
Internal compiler error at gmcsbug.cs(6,16):: exception caught while emitting
MethodBuilder [<FailsToCompile>c__AnonStorey0::<>m__0]
Unhandled Exception: System.InvalidOperationException: can only be called in
generic type
at System.Type.GetField (System.Reflection.FieldInfo fromNoninstanciated)
[0x00000]
at System.Reflection.Emit.TypeBuilder.GetField (System.Type type,
System.Reflection.FieldInfo field) [0x00000]
at Mono.CSharp.FieldExpr.GetConstructedFieldInfo () [0x00000]
at Mono.CSharp.FieldExpr.EmitAssign (Mono.CSharp.EmitContext ec,
Mono.CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load)
[0x00000]
at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean is_statement)
[0x00000]
at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.AnonymousMethodStorey.EmitHoistedFieldsInitialization
(Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.AnonymousMethodStorey.EmitHoistedVariables
(Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.EmitContext.EmitResolvedTopBlock (Mono.CSharp.ToplevelBlock
block, Boolean unreachable) [0x00000]
at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelBlock block) [0x00000]
I tested this only with r118629 from svn.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list