diff options
author | Alexey Bader <alexey.bader@intel.com> | 2017-06-02 18:08:58 +0000 |
---|---|---|
committer | Alexey Bader <alexey.bader@intel.com> | 2017-06-02 18:08:58 +0000 |
commit | a7cab032a96ecedfd0bcb4014e5786b66455a112 (patch) | |
tree | 6b5c0315495e90453e7d6058b3413a4d9eba21fb /test/SemaOpenCL | |
parent | d9cc152d851f682344a4db8070d9542f1913731c (diff) |
[OpenCL] Harden function pointer diagnostics.
Summary: Improve OpenCL type checking by rejecting function pointer types.
Reviewers: Anastasia, yaxunl
Reviewed By: Anastasia
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D33821
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaOpenCL')
-rw-r--r-- | test/SemaOpenCL/func.cl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/SemaOpenCL/func.cl b/test/SemaOpenCL/func.cl index ea3bab6c51..dc5b44057b 100644 --- a/test/SemaOpenCL/func.cl +++ b/test/SemaOpenCL/func.cl @@ -4,8 +4,15 @@ void vararg_f(int, ...); // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}} void __vararg_f(int, ...); typedef void (*vararg_fptr_t)(int, ...); // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}} + // expected-error@-1{{pointers to functions are not allowed}} int printf(__constant const char *st, ...); // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}} +// Struct type with function pointer field +typedef struct s +{ + void (*f)(struct s *self, int *i); // expected-error{{pointers to functions are not allowed}} +} s_t; + //Function pointer void foo(void*); |