diff options
author | Pekka Jaaskelainen <pekka.jaaskelainen@tut.fi> | 2014-02-20 13:52:08 +0000 |
---|---|---|
committer | Pekka Jaaskelainen <pekka.jaaskelainen@tut.fi> | 2014-02-20 13:52:08 +0000 |
commit | a9e178ab754104f72d2450a35d58164ed1f8e5b6 (patch) | |
tree | 45d291e109d867386256a73cd115eb0e478b27d5 /test/SemaOpenCL | |
parent | 3e02f9acc8bdeeda4d16877714604a412f7a649d (diff) |
OpenCL: fix for the restriction on pointers to functions.
Patch from Anastasia Stulova!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaOpenCL')
-rw-r--r-- | test/SemaOpenCL/func_ptr.cl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/SemaOpenCL/func_ptr.cl b/test/SemaOpenCL/func_ptr.cl new file mode 100644 index 0000000000..f21a3d3265 --- /dev/null +++ b/test/SemaOpenCL/func_ptr.cl @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only + +void foo(void*); + +void bar() +{ + // declaring a function pointer is an error + void (*fptr)(int); // expected-error{{pointers to functions are not allowed}} + + // taking the address of a function is an error + foo((void*)foo); // expected-error{{taking address of function is not allowed}} + foo(&foo); // expected-error{{taking address of function is not allowed}} + + // just calling a function is correct + foo(0); +} |