aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/pointer-addition.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-23 00:36:41 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-23 00:36:41 +0000
commitc983b86514d14dd4b30147bf6791dde9487d2c3f (patch)
tree07d79ad962013eb73d0a1fd29b5d23971e48e919 /test/Sema/pointer-addition.c
parent990bd1edb54d439c6f59ec3917c873f61ad21fb7 (diff)
Support arithmetic on pointer-to-function types as a GNU
extension. Addresses clang PR/3371. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62823 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/pointer-addition.c')
-rw-r--r--test/Sema/pointer-addition.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/Sema/pointer-addition.c b/test/Sema/pointer-addition.c
index 95f364fc67..81a1dc06c1 100644
--- a/test/Sema/pointer-addition.c
+++ b/test/Sema/pointer-addition.c
@@ -2,13 +2,18 @@
typedef struct S S; // expected-note{{forward declaration of 'struct S'}}
void a(S* b, void* c) {
+ void (*fp)(int) = 0;
b++; // expected-error {{arithmetic on pointer to incomplete type}}
b += 1; // expected-error {{arithmetic on pointer to incomplete type}}
c++; // expected-warning {{use of GNU void* extension}}
c += 1; // expected-warning {{use of GNU void* extension}}
+ c--; // expected-warning {{use of GNU void* extension}}
+ c -= 1; // expected-warning {{use of GNU void* extension}}
b = 1+b; // expected-error {{arithmetic on pointer to incomplete type}}
/* The next couple tests are only pedantic warnings in gcc */
void (*d)(S*,void*) = a;
- d += 1; // expected-error {{arithmetic on pointer to function type}}}
- d++; // expected-error {{arithmetic on pointer to function type}}}
+ d += 1; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}
+ d++; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}}
+ d--; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}
+ d -= 1; // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}
}