aboutsummaryrefslogtreecommitdiff
blob: 855948f0615ebfe2ef05978d6e01d225441c131e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -verify -fsyntax-only
//RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -verify -fsyntax-only -DFUNCPTREXT

#ifdef FUNCPTREXT
#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable
//expected-no-diagnostics
#endif

// Check that pointer to member functions are diagnosed
// unless specific clang extension is enabled.
struct C {
  void f(int n);
};

typedef void (C::*p_t)(int);
#ifndef FUNCPTREXT
//expected-error@-2{{pointers to functions are not allowed}}
#endif

void test() {
  void (C::*p)(int);
#ifndef FUNCPTREXT
//expected-error@-2{{pointers to functions are not allowed}}
#endif
}