| 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. |
| 11 |
struct C { |
| 12 |
void f(int n); |
| 13 |
}; |
| 14 |
|
| 15 |
typedef void (C::*p_t)(int); |
| 16 |
#ifndef FUNCPTREXT |
| 17 |
//expected-error@-2{{pointers to functions are not allowed}} |
| 18 |
#endif |
| 19 |
|
| 20 |
void test() { |
| 21 |
void (C::*p)(int); |
| 22 |
#ifndef FUNCPTREXT |
| 23 |
//expected-error@-2{{pointers to functions are not allowed}} |
| 24 |
#endif |
| 25 |
} |