Skip to content

gmacros: Guard C++ code with extern "C++"

Kalev Lember requested to merge wip/kalev/decltype-extern-Cplusplus into master

A number of C++ consumers are (incorrectly) including glib headers in an extern "C" block, which leads to build failures such as:

/usr/include/c++/11/type_traits:56:3: error: template with C linkage
   56 |   template<typename _Tp, _Tp __v>
      |   ^~~~~~~~

We can easily escape that on the glib side by putting the C++ code in an extern "C++" block. Which technically it's a bug on the consuming program's side, I think it's pragmatic here to work this around on the glib side.

Edited by Emmanuele Bassi

Merge request reports