glib 2.67.3: <glib.h> can no longer be included in extern "C" blocks
I would be surprised if wrapping #include <glib.h>
in extern "C"
was officially supported, but it turns out quite a few packages do it anyway.
$ cat glibtest.cc
extern "C" {
#include <glib.h>
}
$ g++ -c glibtest.cc `pkg-config --cflags glib-2.0`
In file included from /usr/include/glib-2.0/glib/gmacros.h:241,
from /usr/libx32/glib-2.0/include/glibconfig.h:9,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from glibtest.cc:2:
/usr/lib/gcc/x86_64-linux-gnux32/10.2.0/include/c++/type_traits:56:3: error: template with C linkage
56 | template<typename _Tp, _Tp __v>
| ^~~~~~~~
glibtest.cc:1:1: note: ‘extern "C"’ linkage started here
1 | extern "C" {
| ^~~~~~~~~~
[...]
This worked in glib 2.67.2 but breaks as shown above in glib 2.67.3. This breaks the builds of at least inkscape, qemu, firefox, thunderbird.
I am reporting this here first, to ask if this should be supported by glib. If you decide this should not be supported, I will report this as a bug against the packages doing this.