PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / obj-c++.dg / try-catch-13.mm
blob050d81135556f92d8b8a7846452d2d4a799ef503
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.  */
5 /* { dg-options "-fobjc-exceptions" } */
6 /* { dg-do compile } */
8 @interface TestMyTests
9 - (void) testSpoon;
10 @end
12 extern void some_func (int *); /* { dg-line some_func_decl } */
14 @implementation TestMyTests
15 - (void) testSpoon {
16   volatile int i = 5;
17   int q = 99;
19   do {
20     @try {
21       typeof(i) j = 6;
22       typeof(q) k = 66;
23       some_func (&j);
24 /* { dg-error "invalid conversion" "" { target *-*-* } .-1 } */ 
25 /* { dg-message "initializing argument" "" { target *-*-* } some_func_decl } */
26       some_func (&k);
27     }
28     @catch (id exc) {
29       @throw;
30     }
31   } while(0);
33   do {
34     @try {
35       typeof(i) j = 7;
36       typeof(q) k = 77;
37       some_func (&k);
38       some_func (&j);
39 /* { dg-error "invalid conversion" "" { target *-*-* } .-1 } */
40 /* The following is disabled as it is already checked above and the testsuites seems 
41    to count multiple different identical errors on the same line only once */
42 /*  dg-message "initializing argument" "" { target *-*-* } some_func_decl  */
43     }
44     @catch (id exc) {
45       @throw;
46     }
47   } while(0);
49   do {
50     @try {
51       typeof(q) k = 88;
52       typeof(i) j = 8;
53       some_func (&j); 
54 /* { dg-error "invalid conversion" "" { target *-*-* } .-1 } */
55 /* The following is disabled as it is already checked above and the testsuites seems 
56    to count multiple different identical errors on the same line only once */
57 /*  dg-message "initializing argument" "" { target *-*-* } some_func_decl  */
58       some_func (&k);
59     }
60     @catch (id exc) {
61       @throw;
62     }
63   } while(0);
64       
66 @end