| 1 |
/* Ensure that variables declared volatile by the user (as opposed to |
| 2 |
synthesized by the EH-volatization machinery) _do_ trigger |
| 3 |
"discards qualifiers from target pointer type" warnings. */ |
| 4 |
|
| 5 |
/* { dg-options "-fobjc-exceptions" } */ |
| 6 |
/* { dg-do compile } */ |
| 7 |
// { dg-additional-options "-Wno-objc-root-class" } |
| 8 |
|
| 9 |
@interface TestMyTests |
| 10 |
- (void) testSpoon; |
| 11 |
@end |
| 12 |
|
| 13 |
extern void some_func (int *); /* { dg-line some_func_decl } */ |
| 14 |
|
| 15 |
@implementation TestMyTests |
| 16 |
- (void) testSpoon { |
| 17 |
volatile int i = 5; |
| 18 |
int q = 99; |
| 19 |
|
| 20 |
do { |
| 21 |
@try { |
| 22 |
typeof(i) j = 6; |
| 23 |
typeof(q) k = 66; |
| 24 |
some_func (&j); |
| 25 |
/* { dg-error "invalid conversion" "" { target *-*-* } .-1 } */ |
| 26 |
/* { dg-message "initializing argument" "" { target *-*-* } some_func_decl } */ |
| 27 |
some_func (&k); |
| 28 |
} |
| 29 |
@catch (id exc) { |
| 30 |
@throw; |
| 31 |
} |
| 32 |
} while(0); |
| 33 |
|
| 34 |
do { |
| 35 |
@try { |
| 36 |
typeof(i) j = 7; |
| 37 |
typeof(q) k = 77; |
| 38 |
some_func (&k); |
| 39 |
some_func (&j); |
| 40 |
/* { dg-error "invalid conversion" "" { target *-*-* } .-1 } */ |
| 41 |
/* The following is disabled as it is already checked above and the testsuites seems |
| 42 |
to count multiple different identical errors on the same line only once */ |
| 43 |
/* dg-message "initializing argument" "" { target *-*-* } some_func_decl */ |
| 44 |
} |
| 45 |
@catch (id exc) { |
| 46 |
@throw; |
| 47 |
} |
| 48 |
} while(0); |
| 49 |
|
| 50 |
do { |
| 51 |
@try { |
| 52 |
typeof(q) k = 88; |
| 53 |
typeof(i) j = 8; |
| 54 |
some_func (&j); |
| 55 |
/* { dg-error "invalid conversion" "" { target *-*-* } .-1 } */ |
| 56 |
/* The following is disabled as it is already checked above and the testsuites seems |
| 57 |
to count multiple different identical errors on the same line only once */ |
| 58 |
/* dg-message "initializing argument" "" { target *-*-* } some_func_decl */ |
| 59 |
some_func (&k); |
| 60 |
} |
| 61 |
@catch (id exc) { |
| 62 |
@throw; |
| 63 |
} |
| 64 |
} while(0); |
| 65 |
|
| 66 |
} |
| 67 |
@end |
| 68 |
|