Eli Friedman | d72d16e | 2008-05-18 18:08:51 +0000 | [diff] [blame] | 1 | // RUN: clang %s -fsyntax-only -verify -pedantic |
| 2 | |
Douglas Gregor | 4ec339f | 2009-01-19 19:26:10 +0000 | [diff] [blame] | 3 | typedef struct S S; // expected-note{{forward declaration of 'struct S'}} |
Eli Friedman | d72d16e | 2008-05-18 18:08:51 +0000 | [diff] [blame] | 4 | void a(S* b, void* c) { |
Douglas Gregor | c983b86 | 2009-01-23 00:36:41 +0000 | [diff] [blame^] | 5 | void (*fp)(int) = 0; |
Eli Friedman | d72d16e | 2008-05-18 18:08:51 +0000 | [diff] [blame] | 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}} |
Douglas Gregor | c983b86 | 2009-01-23 00:36:41 +0000 | [diff] [blame^] | 10 | c--; // expected-warning {{use of GNU void* extension}} |
| 11 | c -= 1; // expected-warning {{use of GNU void* extension}} |
Eli Friedman | d72d16e | 2008-05-18 18:08:51 +0000 | [diff] [blame] | 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; |
Douglas Gregor | c983b86 | 2009-01-23 00:36:41 +0000 | [diff] [blame^] | 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}} |
Eli Friedman | d72d16e | 2008-05-18 18:08:51 +0000 | [diff] [blame] | 19 | } |