blob: aa425a7fd9d9810a0215a8ae926367d5ac659078 [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
Eli Friedman8e122982008-05-18 18:08:51 +00002
Sebastian Redl2175b6a2009-02-07 19:52:04 +00003typedef struct S S; // expected-note 3 {{forward declaration of 'struct S'}}
Eli Friedman8e122982008-05-18 18:08:51 +00004void a(S* b, void* c) {
Douglas Gregorf6cd9282009-01-23 00:36:41 +00005 void (*fp)(int) = 0;
Eli Friedman8e122982008-05-18 18:08:51 +00006 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 Gregorf6cd9282009-01-23 00:36:41 +000010 c--; // expected-warning {{use of GNU void* extension}}
11 c -= 1; // expected-warning {{use of GNU void* extension}}
Abramo Bagnara3aabb4b2010-09-13 06:50:07 +000012 (void) c[1]; // expected-warning {{use of GNU void* extension}}
Eli Friedman8e122982008-05-18 18:08:51 +000013 b = 1+b; // expected-error {{arithmetic on pointer to incomplete type}}
14 /* The next couple tests are only pedantic warnings in gcc */
15 void (*d)(S*,void*) = a;
Douglas Gregorf6cd9282009-01-23 00:36:41 +000016 d += 1; // 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--; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}
19 d -= 1; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}
Eli Friedman8e122982008-05-18 18:08:51 +000020}