[Mono-bugs] [Bug 81109][Nor] New - [GMCS] implement `new T()' for unknown generic types

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Mar 11 09:12:39 EDT 2007


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 marek.safar at seznam.cz.

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

--- shadow/81109	2007-03-11 08:12:39.000000000 -0500
+++ shadow/81109.tmp.26233	2007-03-11 08:12:39.000000000 -0500
@@ -0,0 +1,127 @@
+Bug#: 81109
+Product: Mono: Compilers
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: marek.safar at seznam.cz               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] implement `new T()' for unknown generic types
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+It's seems to me we are missing this code path for
+generic types instantiation (CreateInstance<T>).
+However, it should be easy to implement.
+
+
+Steps to reproduce the problem:
+1. 
+
+interface ITest
+{
+	void Test ();
+}
+
+class Tester<T> where T : ITest, new ()
+{
+	public void Do ()
+	{
+		new T ().Test ();
+	}
+}
+
+class Reference : ITest
+{
+	public void Test ()
+	{
+	}
+}
+
+struct Value : ITest
+{
+	public void Test ()
+	{
+	}
+}
+
+class C
+{
+	static void Main ()
+	{
+		new Tester<Reference> ().Do ();
+		new Tester<Value> ().Do ();
+	}
+}
+
+
+Actual Results:
+
+
+
+Expected Results:
+
+
+Unhandled Exception: System.InvalidOperationException: Operation is not
+valid due to the current state of the object
+
+  at Mono.CSharp.New.AddressOf (Mono.CSharp.EmitContext ec, AddressOp Mode)
+[0x00000] 
+
+  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
+is_base, Boolean is_static, Mono.CSharp.Expression instance_expr,
+System.Reflection.MethodBase method, System.Collections.ArrayList
+Arguments, Location loc, Boolean dup_args, Boolean omit_args) [0x00000] 
+
+  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
+is_base, Boolean is_static, Mono.CSharp.Expression instance_expr,
+System.Reflection.MethodBase method, System.Collections.ArrayList
+Arguments, Location loc) [0x00000] 
+
+  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
+
+  at Mono.CSharp.Invocation.EmitStatement (Mono.CSharp.EmitContext ec)
+[0x00000] 
+
+  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec)
+[0x00000] 
+
+  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] 
+
+  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] 
+
+  at Mono.CSharp.Block.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] 
+
+  at Mono.CSharp.MethodData.Emit (Mono.CSharp.DeclSpace parent) [0x00000] 
+
+  at Mono.CSharp.Method.Emit () [0x00000] 
+
+  at Mono.CSharp.TypeContainer.EmitType () [0x00000] 
+
+  at Mono.CSharp.RootContext.EmitCode () [0x00000] 
+
+  at Mono.CSharp.Driver.MainDriver (System.String[] args) [0x00000] 
+
+  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] 
+
+
+How often does this happen? 
+
+
+Additional Information:


More information about the mono-bugs mailing list