Issue |
138683
|
Summary |
[Modules][libc++] Using <filesystem> with -fmodules -fcxx-modules triggers missing‑import errors
|
Labels |
libc++
|
Assignees |
|
Reporter |
devajithvs
|
When compiling a minimal program using `<filesystem>` with `-fmodules -fcxx-modules` using libc++ built from upstream, the compiler fails with module import errors for `time_point` and ` _FilesystemClock.`
Compiling the below code:
```C++
#include <filesystem>
int main() {
std::filesystem::file_time_type::clock::now();
return 0;
}
```
with
```bash
$LLVM_INSTALL/bin/clang++ \
-stdlib=libc++ -nostdinc++ \
-isystem $LLVM_INSTALL/include/x86_64-unknown-linux-gnu/c++/v1 \
-isystem $LLVM_INSTALL/include/c++/v1 \
-fmodules -fcxx-modules \
reproducer.cpp
```
Raises:
```
reproducer.cpp:4:22: error: missing '#include <__chrono/time_point.h>'; 'time_point' must be defined before it is used
4 | std::filesystem::file_time_type::clock::now();
| ^
.../include/c++/v1/__chrono/time_point.h:34:28: note: definition here is not reachable
34 | class _LIBCPP_TEMPLATE_VIS time_point {
| ^
reproducer.cpp:4:38: error: missing '#include <__chrono/file_clock.h>'; '_FilesystemClock' must be defined before it is used
4 | std::filesystem::file_time_type::clock::now();
| ^
.../include/c++/v1/__chrono/file_clock.h:49:8: note: definition here is not reachable
49 | struct _FilesystemClock {
| ^
2 errors generated.
```
Similar failures/warnings were first observed with Apple’s libc++ module map on MacOS with Sonoma 14.6.1 and XCode 15.4 and clang-1500.3.9.4 - See a similar reproduce with AppleClang: https://github.com/root-project/root/pull/16494#issuecomment-2835071220
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs