From 5f380da06f679aea537dfebe9702f12bfa840f3a Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 20 Jun 2011 07:52:11 +0000 Subject: 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. llvm-svn: 133428 --- clang/test/Sema/pointer-addition.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/test/Sema/pointer-addition.c') diff --git a/clang/test/Sema/pointer-addition.c b/clang/test/Sema/pointer-addition.c index aa425a7fd9d..01047a06849 100644 --- a/clang/test/Sema/pointer-addition.c +++ b/clang/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}} } -- cgit v1.2.3