xref: /llvm-project/clang/test/SemaOpenCLCXX/members.clcpp (revision d1c8a151df830c6c727f0bb7d33774bd3eb96824)
1//RUN: %clang_cc1 %s -triple spir -verify -fsyntax-only
2//RUN: %clang_cc1 %s -triple spir -verify -fsyntax-only -DFUNCPTREXT
3
4#ifdef FUNCPTREXT
5#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable
6//expected-no-diagnostics
7#endif
8
9// Check that pointer to member functions are diagnosed
10// unless specific clang extension is enabled.
11struct C {
12  void f(int n);
13};
14
15typedef void (C::*p_t)(int);
16#ifndef FUNCPTREXT
17//expected-error@-2{{pointers to functions are not allowed}}
18#endif
19
20void test() {
21  void (C::*p)(int);
22#ifndef FUNCPTREXT
23//expected-error@-2{{pointers to functions are not allowed}}
24#endif
25}
26