+2008-06-23 Mark Probst <mark.probst@gmail.com>
+
+ * mini.c: Fail sharing of a generic method if it contains an open
+ catch clause (because we don't pass MRGCTXs yet).
+
2008-06-23 Mark Probst <mark.probst@gmail.com>
* mini.c: When compiling a method with generic sharing, insert the
clause->data.catch_class &&
cfg->generic_sharing_context &&
mono_class_check_context_used (clause->data.catch_class)) {
+ if (mono_method_get_context (method)->method_inst)
+ GENERIC_SHARING_FAILURE (CEE_NOP);
+
/*
* In shared generic code with catch
* clauses containing type variables
+2008-06-23 Mark Probst <mark.probst@gmail.com>
+
+ * generic-exceptions.2.cs: Test case for exception handlers in
+ generic methods with catch clauses depending on the method type
+ arguments.
+
+ * Makefile.am: Test added.
+
2008-06-20 Rodrigo Kumpera <rkumpera@novell.com>
* bug-349190.2.cs: Regression test for bug #349190.
generic-static-methods.2.cs \
generic-null-call.2.cs \
generic-special.2.cs \
+ generic-exceptions.2.cs \
recursive-generics.2.cs \
bug-80392.2.cs \
dynamic-method-access.2.cs \
generic-interface-methods.2.exe generic-array-type.2.exe \
generic-method-patching.2.exe generic-static-methods.2.exe \
generic-null-call.2.exe generic-tailcall2.2.exe \
- generic-array-exc.2.exe generic-special.2.exe
+ generic-array-exc.2.exe generic-special.2.exe \
+ generic-exceptions.2.exe
for fn in $+ ; do \
echo "Testing $$fn ..."; \
MONO_GENERIC_SHARING=all $(RUNTIME) -O=gshared $$fn || exit 1; \
--- /dev/null
+using System;
+
+public class GenExc<S,T> : Exception {
+}
+
+public delegate void ThrowDelegate ();
+
+public class Gen<T> {
+ public void catcher<S> (ThrowDelegate thrower) {
+ try {
+ thrower ();
+ }
+ catch (GenExc<S,T>) {
+ }
+ }
+
+ public static void staticCatcher<S> (ThrowDelegate thrower) {
+ try {
+ thrower ();
+ }
+ catch (GenExc<S,T>) {
+ }
+ }
+}
+
+public class main {
+ static void throwObjectObject () {
+ throw new GenExc<object, object> ();
+ }
+
+ static void throwStringObject () {
+ throw new GenExc<string, object> ();
+ }
+
+ static int Main () {
+ Gen<object> go = new Gen<object> ();
+
+ try {
+ go.catcher<object> (new ThrowDelegate (main.throwObjectObject));
+ Gen<object>.staticCatcher<object> (new ThrowDelegate (main.throwObjectObject));
+ go.catcher<string> (new ThrowDelegate (main.throwStringObject));
+ Gen<object>.staticCatcher<string> (new ThrowDelegate (main.throwStringObject));
+ }
+ catch {
+ return 1;
+ }
+
+ try {
+ go.catcher<object> (new ThrowDelegate (main.throwStringObject));
+ return 1;
+ }
+ catch {
+ }
+ try {
+ Gen<object>.staticCatcher<object> (new ThrowDelegate (main.throwStringObject));
+ return 1;
+ }
+ catch {
+ }
+
+ try {
+ go.catcher<string> (new ThrowDelegate (main.throwObjectObject));
+ return 1;
+ }
+ catch {
+ }
+ try {
+ Gen<object>.staticCatcher<string> (new ThrowDelegate (main.throwObjectObject));
+ return 1;
+ }
+ catch {
+ }
+
+ return 0;
+ }
+}