https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120764
Bug ID: 120764 Summary: redefinition errors when using certain std headers in GMF Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: furyusss at yahoo dot fr Target Milestone: --- cat std.cpp module; #include <chrono> // first thing after the Global module fragment must be a module command export module std; export void fun(std::string_view) { } cat main.cpp import std; #include <print> int main() { } g++ -std=c++23 -fmodules-ts -c std.cpp g++ -std=c++23 -fmodules-ts main.cpp -o main In file included from /usr/include/c++/15/concepts:48, from /usr/include/c++/15/compare:42, from /usr/include/c++/15/array:40, from /usr/include/c++/15/format:45, from /usr/include/c++/15/print:43, from main.cpp:3: /usr/include/c++/15/type_traits:94:28: error: template definition of non-template ‘constexpr const _Tp std::integral_constant<_Tp, __v>::value’ [-Wtemplate-body] 94 | static constexpr _Tp value = __v; | ^~~~~ /usr/include/c++/15/type_traits:95:29: error: template definition of non-template ‘using std::integral_constant<_Tp, __v>::value_type = _Tp’ [-Wtemplate-body] 95 | using value_type = _Tp; | ^ /usr/include/c++/15/type_traits:96:47: error: template definition of non-template ‘using std::integral_constant<_Tp, __v>::type = struct std::integral_constant<_Tp, __v>’ [-Wtemplate-body] 96 | using type = integral_constant<_Tp, __v>; | ^ /usr/include/c++/15/type_traits:97:45: error: template definition of non-template ‘constexpr std::integral_constant<_Tp, __v>::operator value_type() const’ [-Wtemplate-body] 97 | constexpr operator value_type() const noexcept { return value; } | ^~~~~~~~ /usr/include/c++/15/type_traits:100:47: error: template definition of non-template ‘constexpr std::integral_constant<_Tp, __v>::value_type std::integral_constant<_Tp, __v>::operator()() const’ [-Wtemplate-body] 100 | constexpr value_type operator()() const noexcept { return value; } | ^~~~~~~~ /usr/include/c++/15/type_traits:219:27: error: redefinition of ‘template<class ... _Bn> constexpr const bool std::__and_v’ 219 | inline constexpr bool __and_v = __and_<_Bn...>::value; | ^~~~~~~ In file included from /usr/include/c++/15/ratio:41, from /usr/include/c++/15/bits/chrono.h:39, from /usr/include/c++/15/chrono:45, from std.cpp:3, of module std, imported at main.cpp:1: /usr/include/c++/15/type_traits:219:27: note: ‘template<class ... _Bn> constexpr const bool std::__and_v<_Bn ...>’ previously declared here 219 | inline constexpr bool __and_v = __and_<_Bn...>::value; | ^~~~~~~ g++ -v gcc version 15.0.1 20250404 (experimental) [master r15-9193-g08e803aa9be] (Ubuntu 15-20250404-0ubuntu1) This seems similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600.