1/* Ensure that typeof()-typed variables inside the @try { } block that
2   "inherit" their EH-volatileness from other variables in the stack frame
3   do not trigger "discards qualifiers from target pointer type" warnings.  */
4
5/* { dg-options "-fobjc-exceptions" } */
6/* { dg-do compile } */
7
8typedef volatile int IOSharedLockData;
9
10@interface TestMyTests
11- (void) testSpoon;
12@end
13
14extern void some_func (int *);
15
16@implementation TestMyTests
17- (void) testSpoon {
18  int i = 5;
19
20  do {
21    @try {
22      typeof(i) j = 6;
23      some_func (&j);
24    }
25    @catch (id exc) {
26      @throw;
27    }
28  } while(0);
29
30  do {
31    @try {
32      typeof(i) j = 7;
33      some_func (&j);
34    }
35    @catch (id exc) {
36      @throw;
37    }
38  } while(0);
39
40  do {
41    @try {
42      typeof(i) j = 8;
43      some_func (&j);
44    }
45    @catch (id exc) {
46      @throw;
47    }
48  } while(0);
49
50}
51@end
52