1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc typedef struct S S; // expected-note 3 {{forward declaration of 'struct S'}}
a(S * b,void * c)4*f4a2713aSLionel Sambuc void a(S* b, void* c) {
5*f4a2713aSLionel Sambuc void (*fp)(int) = 0;
6*f4a2713aSLionel Sambuc b++; // expected-error {{arithmetic on a pointer to an incomplete type}}
7*f4a2713aSLionel Sambuc b += 1; // expected-error {{arithmetic on a pointer to an incomplete type}}
8*f4a2713aSLionel Sambuc c++; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
9*f4a2713aSLionel Sambuc c += 1; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
10*f4a2713aSLionel Sambuc c--; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
11*f4a2713aSLionel Sambuc c -= 1; // expected-warning {{arithmetic on a pointer to void is a GNU extension}}
12*f4a2713aSLionel Sambuc (void) c[1]; // expected-warning {{subscript of a pointer to void is a GNU extension}}
13*f4a2713aSLionel Sambuc b = 1+b; // expected-error {{arithmetic on a pointer to an incomplete type}}
14*f4a2713aSLionel Sambuc /* The next couple tests are only pedantic warnings in gcc */
15*f4a2713aSLionel Sambuc void (*d)(S*,void*) = a;
16*f4a2713aSLionel Sambuc d += 1; // expected-warning {{arithmetic on a pointer to the function type 'void (S *, void *)' is a GNU extension}}
17*f4a2713aSLionel Sambuc d++; // expected-warning {{arithmetic on a pointer to the function type 'void (S *, void *)' is a GNU extension}}
18*f4a2713aSLionel Sambuc d--; // expected-warning {{arithmetic on a pointer to the function type 'void (S *, void *)' is a GNU extension}}
19*f4a2713aSLionel Sambuc d -= 1; // expected-warning {{arithmetic on a pointer to the function type 'void (S *, void *)' is a GNU extension}}
20*f4a2713aSLionel Sambuc (void)(1 + d); // expected-warning {{arithmetic on a pointer to the function type 'void (S *, void *)' is a GNU extension}}
21*f4a2713aSLionel Sambuc }
22