diff options
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/try-catch-15.mm')
-rw-r--r-- | gcc/testsuite/obj-c++.dg/try-catch-15.mm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/try-catch-15.mm b/gcc/testsuite/obj-c++.dg/try-catch-15.mm new file mode 100644 index 000000000..01b3d5cbf --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-15.mm @@ -0,0 +1,34 @@ +/* Test if addition of 'volatile' to object causes bogus error in presence of try-catch. */ +/* { dg-options "-fobjc-exceptions" } */ +/* { dg-do compile } */ + +@interface Exception +@end + +class CppObj { +public: + void constMethod() const { + } +}; + +@interface MyObject : Exception +- (void)doSomething; +- (void)myMethod; +@end + +@implementation MyObject +- (void)doSomething { +} + +- (void)myMethod { + CppObj cppObj; + + @try { + [self doSomething]; + } + @catch (Exception *exception) { + } + + cppObj.constMethod(); +} +@end |