-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Open
Labels
clang:modulesC++20 modules and Clang Header ModulesC++20 modules and Clang Header Modules
Description
main.cpp
import pollcoro;
import helper;
int main() {
pollcoro::block_on(helper::async(0));
}
This fails to compile with the following:
/nix/store/90lsdrdffwgf3kjd4sdxjchchg44cr02-clang-wrapper-20.1.8/bin/clang++ -O3 -O3 -DNDEBUG -std=c++20 -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT CMakeFiles/thing.dir/src/main.cpp.o -MF CMakeFiles/thing.dir/src/main.cpp.o.d @CMakeFiles/thing.dir/src/main.cpp.o.modmap -o CMakeFiles/thing.dir/src/main.cpp.o -c /home/troy/github/paravision/tmp/src/main.cpp
In module 'pollcoro' imported from /home/troy/github/paravision/tmp/src/main.cpp:8:
In module 'pollcoro:mutex' imported from /home/troy/github/paravision/tmp/build/_deps/pollcoro-src/src/pollcoro.cppm:46:
/nix/store/y28c83zz73yr4vwz1fsl4nsrn6yz5fj0-gcc-14.3.0/include/c++/14.3.0/x86_64-unknown-linux-gnu/bits/gthr-default.h:313:1: error: definition with same mangled name '_ZL18__gthread_active_pv' as another definition
313 | __gthread_active_p (void)
| ^
/nix/store/y28c83zz73yr4vwz1fsl4nsrn6yz5fj0-gcc-14.3.0/include/c++/14.3.0/x86_64-unknown-linux-gnu/bits/gthr-default.h:313:1: note: previous definition is here
313 | __gthread_active_p (void)
| ^
1 error generated.
ninja: build stopped: subcommand failed.
error: Recipe `build` failed on line 2 with exit code 1helper.cppm
module;
#include <utility>
export module helper;
import pollcoro;
export namespace helper {
template<typename T>
auto async(T value) {
auto [awaitable, setter] = pollcoro::single_event<T>();
setter.set(std::move(value));
return std::move(awaitable);
}
} // helperpollcoro is https://github.com/troyKomodo/pollcoro
The following 2 fix the error:
- adding
#include <thread>tomain.cpp - removing the template on
helperinhelper.cppm
Reproducible repo: https://github.com/TroyKomodo/cxx-compiler-bug
Possibly related:
#137533
Metadata
Metadata
Assignees
Labels
clang:modulesC++20 modules and Clang Header ModulesC++20 modules and Clang Header Modules