-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Closed
Closed
Copy link
Labels
clang:modulesC++20 modules and Clang Header ModulesC++20 modules and Clang Header Modules
Description
I'm testing with LLVM/Clang head (607b4bc). I have some code where I #include
after doing an import
:
import utpp;
#include <fstream>
#include <numeric>
#include <streambuf>
#include <string>
When compiling with -fskip-odr-check-in-gmf
(which is the default now, I think), I'm getting a "redefinition of concept" error:
/llvm-project/prefix/bin/clang++ -m64 -stdlib=libc++ -Xclang -fskip-odr-check-in-gmf -Wno-deprecated-declarations -O2 -g -DNDEBUG -std=c++23 -fcolor-diagnostics -MD -MT example/CMakeFiles/utpp_gherkin_feature.dir/gherkin.cpp.o -MF example/CMakeFiles/utpp_gherkin_feature.dir/gherkin.cpp.o.d @example/CMakeFiles/utpp_gherkin_feature.dir/gherkin.cpp.o.modmap -o example/CMakeFiles/utpp_gherkin_feature.dir/gherkin.cpp.o -c /home/jan/git/utpp/example/gherkin.cpp
In file included from /home/jan/git/utpp/example/gherkin.cpp:9:
In file included from /llvm-project/prefix/bin/../include/c++/v1/fstream:199:
In file included from /llvm-project/prefix/bin/../include/c++/v1/filesystem:538:
In file included from /llvm-project/prefix/bin/../include/c++/v1/__filesystem/directory_entry.h:20:
In file included from /llvm-project/prefix/bin/../include/c++/v1/__filesystem/filesystem_error.h:15:
In file included from /llvm-project/prefix/bin/../include/c++/v1/__filesystem/path.h:30:
In file included from /llvm-project/prefix/bin/../include/c++/v1/iomanip:46:
In file included from /llvm-project/prefix/bin/../include/c++/v1/istream:170:
In file included from /llvm-project/prefix/bin/../include/c++/v1/ostream:188:
In file included from /llvm-project/prefix/bin/../include/c++/v1/format:194:
In file included from /llvm-project/prefix/bin/../include/c++/v1/__format/container_adaptor.h:20:
In file included from /llvm-project/prefix/bin/../include/c++/v1/__format/range_default_formatter.h:23:
In file included from /llvm-project/prefix/bin/../include/c++/v1/__format/range_formatter.h:23:
In file included from /llvm-project/prefix/bin/../include/c++/v1/__format/format_context.h:30:
/llvm-project/prefix/bin/../include/c++/v1/optional:565:9: error: redefinition of concept '__is_derived_from_optional' with different template parameters or requirem
ents
565 | concept __is_derived_from_optional = requires(const _Tp& __t) { []<class _Up>(const optional<_Up>&) {}(__t); };
| ^
/llvm-project/prefix/bin/../include/c++/v1/__ranges/movable_box.h:21:10: note: '/llvm-project/prefix/bin/../include/c++/v1/optional' inclu
ded multiple times, additional include site in header from module 'std.<global>'
21 | #include <optional>
| ^
/llvm-project/prefix/share/libc++/v1/std.cppm:14:1: note: std.<global> defined here
14 | module;
| ^
/llvm-project/prefix/bin/../include/c++/v1/__format/format_context.h:30:12: note: '/llvm-project/prefix/bin/../include/c++/v1/optional' in
cluded multiple times, additional include site here
30 | # include <optional>
| ^
When compiling with -fno-skip-odr-check-in-gmf
, it finishes compiling without error. Which is curious, since I had assumed that enabling -fskip-odr-check-in-gmf
would always result in less errors, not more.
Another data point: on LLVM/Clang from 2024-02-22, this compiled without error without any additional compiler arguments.
So now, I have to do one of the following to make the error go away:
- Specify
-fno-skip-odr-check-in-gmf
- or move the
import
after the#include
s
Has anyone an idea how/why this could happen? I could try to bisect this, but this could take a while...
Metadata
Metadata
Assignees
Labels
clang:modulesC++20 modules and Clang Header ModulesC++20 modules and Clang Header Modules