summaryrefslogtreecommitdiff
path: root/tools/conf_tests/can_assign_non_extern_c_functions_to_extern_c_cb.cc
blob: d3c937fb8b14fd423b4f7f55802fb8f065d48864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Configuration-time test program, used in Meson build.
// Check whether the compiler allows us to use a non-extern "C" function,
// such as a static member function, to an extern "C" function pointer,
// such as a GTK callback.
// Corresponds to the M4 macro GLIBMM_CXX_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS.

extern "C"
{
struct somestruct
{
  void (*callback) (int);
};
} // extern "C"

void somefunction(int) {}

int main()
{
  somestruct something;
  something.callback = &somefunction;
  return 0;
}