[libcxx-commits] [libcxx] [libc++] Implement LWG3430 disallow implicit conversion of the source arguments to `std::filesystem::path` when constructing `std::basic_*fstream` (PR #85079)

Nico Weber via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 11 10:52:02 PDT 2024


================
@@ -158,8 +158,8 @@ public:
     basic_fstream();
     explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
     explicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
-    explicit basic_fstream(const filesystem::path& p,
-                           ios_base::openmode mode = ios_base::in|ios_base::out); C++17
+    template<class T>
+    explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out); // Since C++17
----------------
nico wrote:

Actually, https://en.cppreference.com/w/cpp/io/basic_fstream/basic_fstream mentions a `const std::filesystem::path::value_type*` overload which kinda happened to work before this change (since it'd construct a `::path` and call that ctor), but this change breaks that. Should we undo this change here until an explicit `const std::filesystem::path::value_type*` ctor exists?

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


More information about the libcxx-commits mailing list