https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115885
Bug ID: 115885 Summary: Build errors when libstdc++ math.h included in extern "C" block Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: kacper.slominski72 at gmail dot com Target Milestone: --- Since r15-1857-gde19b516edbf919d31e9d22fdbf6066342d904a2 bits/cpp_type_traits.h now includes <type_traits>. This means that <cmath>, and the libstdc++ <math.h> now also transitively include <type_traits>. This causes the following build errors if <math.h> is included somewhere inside an `extern "C"` block: In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/cpp_type_traits.h:40, from /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/cmath:44, from /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/math.h:36, from /usr/include/libavutil/common.h:36, from /usr/include/libavutil/avutil.h:301, from /usr/include/libavcodec/codec_par.h:26, from /usr/include/libavformat/avformat.h:312, from /var/tmp/portage/dev-qt/qtmultimedia-6.7.2-r1/work/qtmultimedia-everywhere-src-6.7.2/src/plugins/multimedia/ffmpeg/qffmpegdefs_p.h:19, from /var/tmp/portage/dev-qt/qtmultimedia-6.7.2-r1/work/qtmultimedia-everywhere-src-6.7.2/src/plugins/multimedia/ffmpeg/qffmpeg_p.h:17, from /var/tmp/portage/dev-qt/qtmultimedia-6.7.2-r1/work/qtmultimedia-everywhere-src-6.7.2/src/plugins/multimedia/ffmpeg/qffmpeg.cpp:4, from /var/tmp/portage/dev-qt/qtmultimedia-6.7.2-r1/work/qtmultimedia-everywhere-src-6.7.2_build/src/plugins/multimedia/ffmpeg/CMakeFiles/QFFmpegMediaPlugin.dir/Unity/unity_0_cxx.cxx:7: /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/type_traits:69:3: error: template with C linkage 69 | template<typename _Tp> | ^~~~~~~~ /var/tmp/portage/dev-qt/qtmultimedia-6.7.2-r1/work/qtmultimedia-everywhere-src-6.7.2/src/plugins/multimedia/ffmpeg/qffmpegdefs_p.h:18:1: note: ‘extern "C"’ linkage started here 18 | extern "C" { | ^~~~~~~~~~ qtmultimedia does the following in qffmpegdefs_p.h: extern "C" { #include <libavformat/avformat.h> #include <libavcodec/avcodec.h> #include <libswresample/swresample.h> #include <libavutil/avutil.h> #include <libswscale/swscale.h> }