aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/function-ptr.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-03 22:56:36 +0000
committerChris Lattner <sabre@nondot.org>2008-01-03 22:56:36 +0000
commitbfe639e4d39b1afa05d66aaea0378d6c10df4ffc (patch)
tree7a7cb2434f1ba663661efc390023627637e263c3 /test/Sema/function-ptr.c
parent58ca5f5d6aad90a2647a2b8b8baddd714cf6da65 (diff)
give better diagnostics for converting between function pointer and void*.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45556 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/function-ptr.c')
-rw-r--r--test/Sema/function-ptr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Sema/function-ptr.c b/test/Sema/function-ptr.c
new file mode 100644
index 0000000000..83e4d74b6a
--- /dev/null
+++ b/test/Sema/function-ptr.c
@@ -0,0 +1,11 @@
+// RUN: clang %s -verify -pedantic
+typedef int unary_int_func(int arg);
+unary_int_func *func;
+
+unary_int_func *set_func(void *p) {
+ func = p; // expected-warning {{converts between void* and function pointer}}
+ p = func; // expected-warning {{converts between void* and function pointer}}
+
+ return p; // expected-warning {{converts between void* and function pointer}}
+}
+