[libcxx-commits] [libcxx] [libc++] Don't use `copy_file_impl_fstream` when not declared (PR #214706)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 11 11:47:22 PDT 2026


================
@@ -360,7 +360,7 @@ bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_cod
   ec.clear();
   return true;
 }
-#elif defined(_LIBCPP_FILESYSTEM_USE_FSTREAM)
+#elif defined(_LIBCPP_FILESYSTEM_USE_FSTREAM) && defined(_LIBCPP_FILESYSTEM_NEED_FSTREAM)
 bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
   return copy_file_impl_fstream(read_fd, write_fd, ec);
----------------
ldionne wrote:

```suggestion
#  if !defined(_LIBCPP_FILESYSTEM_HAS_FSTREAM_FALLBACK)
#  error copy_file intends to use std::fstream as a fallback, but std::fstream is not available in this configuration
#  endif
  return copy_file_impl_fstream(read_fd, write_fd, ec);
```

https://github.com/llvm/llvm-project/pull/214706


More information about the libcxx-commits mailing list