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// { dg-additional-options "-Wno-objc-root-class" }
8
9typedef volatile int IOSharedLockData;
10
11@interface TestMyTests
12- (void) testSpoon;
13@end
14
15extern void some_func (int *);
16
17@implementation TestMyTests
18- (void) testSpoon {
19  int i = 5;
20
21  do {
22    @try {
23      typeof(i) j = 6;
24      some_func (&j);
25    }
26    @catch (id exc) {
27      @throw;
28    }
29  } while(0);
30
31  do {
32    @try {
33      typeof(i) j = 7;
34      some_func (&j);
35    }
36    @catch (id exc) {
37      @throw;
38    }
39  } while(0);
40
41  do {
42    @try {
43      typeof(i) j = 8;
44      some_func (&j);
45    }
46    @catch (id exc) {
47      @throw;
48    }
49  } while(0);
50
51}
52@end
53