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
8@interface TestMyTests
9- (void) testSpoon;
10@end
11
12extern void some_func (int *); /* { dg-line some_func_decl } */
13
14@implementation TestMyTests
15- (void) testSpoon {
16  volatile int i = 5;
17  int q = 99;
18
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);
32
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);
48
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
65}
66@end
67
68