public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "m.cencora at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF Date: Fri, 05 Apr 2024 10:07:07 +0000 [thread overview] Message-ID: <bug-114600-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600 Bug ID: 114600 Summary: [modules] redefinition errors when using certain std headers in GMF Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: m.cencora at gmail dot com Target Milestone: --- $ cat std.cpp module; #include <type_traits> export module std; $ cat main.cpp import std; #include <type_traits> int main() { } $ g++ -std=c++20 -fmodules-ts -c std.cpp $ g++ -std=c++20 -fmodules-ts main.cpp -o main In file included from main.cpp:3: /usr/include/c++/14/type_traits:89:36: error: template definition of non-template ‘constexpr const _Tp std::integral_constant<_Tp, __v>::value’ 89 | static constexpr _Tp value = __v; | ^~~ /usr/include/c++/14/type_traits:90:29: error: template definition of non-template ‘using std::integral_constant<_Tp, __v>::value_type = _Tp’ 90 | using value_type = _Tp; | ^ /usr/include/c++/14/type_traits:91:47: error: template definition of non-template ‘using std::integral_constant<_Tp, __v>::type = struct std::integral_constant<_Tp, __v>’ 91 | using type = integral_constant<_Tp, __v>; | ^ /usr/include/c++/14/type_traits:92:45: error: template definition of non-template ‘constexpr std::integral_constant<_Tp, __v>::operator value_type() const’ 92 | constexpr operator value_type() const noexcept { return value; } | ^~~~~~~~ /usr/include/c++/14/type_traits:95:47: error: template definition of non-template ‘constexpr std::integral_constant<_Tp, __v>::value_type std::integral_constant<_Tp, __v>::operator()() const’ 95 | constexpr value_type operator()() const noexcept { return value; } | ^~~~~~~~ /usr/include/c++/14/type_traits:963:26: error: redefinition of default argument for ‘class _Up’ 963 | template<typename _Tp, typename _Up = _Tp&&> | ^~~~~~~~ In file included from std.cpp:3, of module std, imported at main.cpp:1: /usr/include/c++/14/type_traits:963:26: note: original definition appeared here 963 | template<typename _Tp, typename _Up = _Tp&&> | ^~~~~~~~ /usr/include/c++/14/type_traits:2470:10: error: redefinition of ‘template<class _Tp> decltype (__declval<_Tp>(0)) std::declval()’ 2470 | auto declval() noexcept -> decltype(__declval<_Tp>(0)) | ^~~~~~~ /usr/include/c++/14/type_traits:2470:10: note: ‘template<class _Tp> decltype (__declval<_Tp>(0)) std::declval@std()’ previously declared here === Seems like merging of GMFs does not work sometimes. Also if I create a preprocessed file for <type_traits> $ g++- -std=c++20 -fmodules-ts -x c++-system-header -E type_traits -o common.hpp and include this "common.hpp" instead of <type_traits> in both cpp files, then compilation succeeds. This works fine on gcc-13 (at least for <type_traits> header)
next reply other threads:[~2024-04-05 10:07 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-05 10:07 m.cencora at gmail dot com [this message] 2024-04-05 10:07 ` [Bug c++/114600] " m.cencora at gmail dot com 2024-04-05 12:55 ` [Bug c++/114600] [14 Regression] " ppalka at gcc dot gnu.org 2024-04-05 12:58 ` ppalka at gcc dot gnu.org 2024-04-05 13:10 ` nshead at gcc dot gnu.org 2024-04-05 13:33 ` ppalka at gcc dot gnu.org 2024-04-10 13:24 ` nshead at gcc dot gnu.org 2024-04-10 14:27 ` m.cencora at gmail dot com 2024-04-10 15:41 ` redi at gcc dot gnu.org 2024-04-10 20:55 ` m.cencora at gmail dot com 2024-04-10 21:03 ` m.cencora at gmail dot com 2024-04-15 8:26 ` cvs-commit at gcc dot gnu.org 2024-04-24 13:46 ` ppalka at gcc dot gnu.org 2024-04-24 13:50 ` ppalka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-114600-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).