summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/try-catch-15.mm
blob: 01b3d5cbfb4c97719eb2da6e87fdb2683664c583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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