4 using System::Exceptions::Exception;
5 using namespace System::Exceptions::Std;
12 SystemException *se, *se2;
18 // Upcasts can be done directly.
21 // Downcast not needed, but should work anyway
22 e = Exception::downcast(&inf);
24 MemoryFault *mf2 = MemoryFault::downcast(se),
25 *mf3 = MemoryFault::downcast(e);
26 InstrFault *inf2 = InstrFault::downcast(se),
27 *inf3 = InstrFault::downcast(e);
28 OutOfMemory *oom = OutOfMemory::downcast(e),
29 *oom2 = OutOfMemory::downcast(&aif);
31 e2 = Exception::downcast(&aif);
32 se2 = SystemException::downcast(foo);
34 printf("Exception: %p %p (should be: ptr NULL)\n", e, e2);
35 printf("SystemException: %p %p (should be: ptr NULL)\n", se, se2);
36 printf("MemoryFault: %p %p (should be: ptr NULL)\n", mf2, mf3);
37 printf("InstrFault: %p %p (should be: NULL ptr)\n", inf2, inf3);
38 printf("OutOfMemory: %p %p (should be: NULL NULL)\n", oom, oom2);