[Bug c++/114990] Compiler errors in <type_traits> compiling a module-based app
unlvsur at live dot com
gcc-bugzilla@gcc.gnu.org
Tue Jul 2 15:23:24 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114990
--- Comment #12 from cqwrteur <unlvsur at live dot com> ---
(In reply to Jason Merrill from comment #10)
> (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
std is actually just one example. It applies to any library that have the same
dependency issue.
More information about the Gcc-bugs
mailing list