2008-09-25 Dick Porter <dick@ximian.com>
[mono.git] / mono / mini / exceptions.cs
index 6971d0e681a3b3174ef1c5a62717f986be9344bc..f6270f6a4e40b746227c4ae0aa3855edc71f53ab 100644 (file)
@@ -2208,6 +2208,30 @@ class Tests {
                return i;
        }
 
+       public static void rethrow () {
+               try {
+                       throw new ApplicationException();
+               } catch (ApplicationException) {
+                       try {
+                               throw new OverflowException();
+                       } catch (Exception) {
+                               throw;
+                       }
+               }
+       }
+
+       // Test that a rethrow rethrows the correct exception
+       public static int test_0_rethrow_nested () {
+               try {
+                       rethrow ();
+               } catch (OverflowException) {
+                       return 0;
+               } catch (Exception) {
+                       return 1;
+               }
+               return 2;
+       }
+
        /* MarshalByRefObject prevents the methods from being inlined */
        class ThrowClass : MarshalByRefObject {
                public static void rethrow1 () {