[Bug c++/114990] Compiler errors in <type_traits> compiling a module-based app
jason at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 2 15:02:03 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114990
--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to cqwrteur from comment #9)
> (In reply to Jason Merrill from comment #8)
> > bar.cppm:4:20: error: conflicting declaration of ‘void foo()’ in module ‘bar’
> > 4 | export inline void foo() noexcept;
> > | ^~~
> > In file included from bar.cppm:2:
> > someheader.hpp:1:13: note: previously declared in global module
>
> That is my problem. This just breaks header only libraries right?
No, you just need to #include the library header before the "export module"
line. Or better yet, use import <header> instead of #include.
> This is the same.
>
> import std;
> #include<aheaderonlylibrary> //it uses std features.
>
> This is absolutely the standard bug.
This is a GCC bug, as described in comment #1. If you
import <aheaderonlylibrary>;
instead, it should work fine. Naturally, that requires that you first
g++ -fmodules-ts -c -x c++-system-header aheaderonlylibrary
More information about the Gcc-bugs
mailing list