aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/pointer-addition.c
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-06-20 07:52:11 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-06-20 07:52:11 +0000
commitae0bafa229d076a0fb90b5aeccea7e3039c58751 (patch)
tree6d329e2afe0efa314e0feb5dfef54f65334311ae /test/Sema/pointer-addition.c
parentc04985647bbd54d53b1f1219287eddce8ff530b5 (diff)
Fix a problem with the diagnostics of invalid arithmetic with function
pointers I found while working on the NULL arithmetic warning. We here always assuming the LHS was the pointer, instead of using the selected pointer expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/pointer-addition.c')
-rw-r--r--test/Sema/pointer-addition.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/Sema/pointer-addition.c b/test/Sema/pointer-addition.c
index aa425a7fd9..01047a0684 100644
--- a/test/Sema/pointer-addition.c
+++ b/test/Sema/pointer-addition.c
@@ -14,7 +14,8 @@ void a(S* b, void* c) {
/* The next couple tests are only pedantic warnings in gcc */
void (*d)(S*,void*) = a;
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--; // 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}}
+ (void)(1 + d); // expected-warning {{arithmetic on pointer to function type 'void (*)(S *, void *)' is a GNU extension}}
}