Issue 151127
Summary [regression, libcxx, C++26] __cpp_lib_filesystem is not available in libc++ until <fstream> is included
Labels libc++
Assignees
Reporter vedranmiletic
    Consider the following code:

``` c++
#ifdef __cpp_lib_filesystem
#include <filesystem>
#endif

#include <fstream>

int main() {
#ifdef __cpp_lib_filesystem
  auto path = std::filesystem::current_path().string();
#endif
  return 0;
}
```

Compiling in C++23 mode works both with Clang 19 and 20 (version details below):

```
clang++ -std=c++23 -stdlib=libc++ fs.cpp
```

Compiling in C++26 mode fails with the following error:

```
$ clang++ -std=c++26 -stdlib=libc++ fs.cpp
fs.cpp:9:30: error: no member named 'current_path' in namespace 'std::filesystem'
    9 | auto path = std::filesystem::current_path().string();
      | ~~~~~~~~~~~~~~~~~^
1 error generated.
```

only when using Clang 20 on Arch Linux:

```
$ clang++ --version
clang version 20.1.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```

but compiles fine when using Clang 19 on FreeBSD:

```
% clang++ --version
FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)
Target: x86_64-unknown-freebsd14.3
Thread model: posix
InstalledDir: /usr/bin
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to