https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115797
Bug ID: 115797 Summary: [15 Regression] 'extern "C" { #include <math.h> }' fails with 'error: template with C linkage' since r15-1857-gde19b516edbf91 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Noticed on jemalloc-5.3.0 which tries to defensively wrap all system headers into extern "C": https://github.com/jemalloc/jemalloc/blob/dev/test/include/test/jemalloc_test.h.in#L5 // $ cat /tmp/a.cc extern "C" { #include <math.h> } Since r15-1857-gde19b516edbf91 "libstdc++: Use memchr to optimize std::find [PR88545]" gcc-15 started breaking it (cmath pulls in <type_traits>) as: $ __i__/bin/g++ -c /tmp/a.cc In file included from /tmp/gb/__i__/include/c++/15.0.0/bits/cpp_type_traits.h:40, from /tmp/gb/__i__/include/c++/15.0.0/cmath:44, from /tmp/gb/__i__/include/c++/15.0.0/math.h:36, from /tmp/a.cc:2: /tmp/gb/__i__/include/c++/15.0.0/type_traits:69:3: error: template with C linkage 69 | template<typename _Tp> | ^~~~~~~~ ... Should it compile? It feels like it should and a few `extern "C++"` are missing somewhere. Target: x86_64-pc-linux-gnu