PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / obj-c++.dg / try-catch-12.mm
blobe08f321e8c79f077b5b4cbd41a68dd0b2106b1d4
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.  */
5 /* { dg-options "-fobjc-exceptions" } */
6 /* { dg-do compile } */
8 typedef volatile int IOSharedLockData;
10 @interface TestMyTests
11 - (void) testSpoon;
12 @end
14 extern void some_func (int *);
16 @implementation TestMyTests
17 - (void) testSpoon {
18   int i = 5;
20   do {
21     @try {
22       typeof(i) j = 6;
23       some_func (&j);
24     }
25     @catch (id exc) {
26       @throw;
27     }
28   } while(0);
30   do {
31     @try {
32       typeof(i) j = 7;
33       some_func (&j);
34     }
35     @catch (id exc) {
36       @throw;
37     }
38   } while(0);
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       
51 @end