blob: 34f8bbbfcd6d68947b8805c6a2e606b58f575913 [file] [log] [blame]
Shih-wei Liaof8fd82b2010-02-10 11:10:31 -08001// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
2
3typedef struct S S; // expected-note 3 {{forward declaration of 'struct S'}}
4void a(S* b, void* c) {
5 void (*fp)(int) = 0;
6 b++; // expected-error {{arithmetic on pointer to incomplete type}}
7 b += 1; // expected-error {{arithmetic on pointer to incomplete type}}
8 c++; // expected-warning {{use of GNU void* extension}}
9 c += 1; // expected-warning {{use of GNU void* extension}}
10 c--; // expected-warning {{use of GNU void* extension}}
11 c -= 1; // expected-warning {{use of GNU void* extension}}
12 b = 1+b; // expected-error {{arithmetic on pointer to incomplete type}}
13 /* The next couple tests are only pedantic warnings in gcc */
14 void (*d)(S*,void*) = a;
15 d += 1; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}
16 d++; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}}
17 d--; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}
18 d -= 1; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}
19}