summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental/filesystem/class.path
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/experimental/filesystem/class.path')
-rw-r--r--libcxx/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/libcxx/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp b/libcxx/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
index 4b7ad735c7f..8dd82a845f2 100644
--- a/libcxx/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
@@ -26,6 +26,7 @@
#include <type_traits>
#include <sstream>
#include <cassert>
+#include <iostream>
#include "test_macros.h"
#include "test_iterators.h"
@@ -35,6 +36,8 @@
MultiStringType InStr = MKSTR("abcdefg/\"hijklmnop\"/qrstuvwxyz/123456789");
MultiStringType OutStr = MKSTR("\"abcdefg/\\\"hijklmnop\\\"/qrstuvwxyz/123456789\"");
+
+
template <class CharT>
void doIOTest() {
using namespace fs;
@@ -56,10 +59,40 @@ void doIOTest() {
}
}
+namespace impl {
+using namespace fs;
+
+template <class Stream, class Tp, class = decltype(std::declval<Stream&>() << std::declval<Tp&>())>
+std::true_type is_ostreamable_imp(int);
+
+template <class Stream, class Tp>
+std::false_type is_ostreamable_imp(long);
+
+template <class Stream, class Tp, class = decltype(std::declval<Stream&>() >> std::declval<Tp&>())>
+std::true_type is_istreamable_imp(int);
+
+template <class Stream, class Tp>
+std::false_type is_istreamable_imp(long);
+
+
+} // namespace impl
+
+template <class Stream, class Tp>
+struct is_ostreamable : decltype(impl::is_ostreamable_imp<Stream, Tp>(0)) {};
+template <class Stream, class Tp>
+struct is_istreamable : decltype(impl::is_istreamable_imp<Stream, Tp>(0)) {};
+
+void test_LWG2989() {
+ static_assert(!is_ostreamable<decltype(std::cout), std::wstring>::value, "");
+ static_assert(!is_ostreamable<decltype(std::wcout), std::string>::value, "");
+ static_assert(!is_istreamable<decltype(std::cin), std::wstring>::value, "");
+ static_assert(!is_istreamable<decltype(std::wcin), std::string>::value, "");
+}
int main() {
doIOTest<char>();
doIOTest<wchar_t>();
//doIOTest<char16_t>();
//doIOTest<char32_t>();
+ test_LWG2989();
}
OpenPOWER on IntegriCloud