[libcxx-commits] [libcxx] [libc++] Implement LWG3430 std::fstream & co. should be constructible from string_view (PR #85079)

Xiaoyang Liu via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 13 15:45:00 PDT 2024


================
@@ -21,11 +21,18 @@
 #include <fstream>
 #include <filesystem>
 #include <cassert>
+#include <type_traits>
+
 #include "test_macros.h"
 #include "platform_support.h"
 
 namespace fs = std::filesystem;
 
+struct fake_path {};
+
+static_assert(std::is_constructible_v<std::fstream, fs::path>);
+static_assert(!std::is_constructible_v<std::fstream, fake_path>);
----------------
xiaoyang-sde wrote:

It seems that these code compiles even without this pull request because `fake_path` can't be converted to `filesystem::path`: https://godbolt.org/z/1dcsjdeEb


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


More information about the libcxx-commits mailing list