From 40608ce4c9ba2cfbbb9976d06785699515dff3f2 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 5 May 2017 23:01:38 +0000 Subject: [PATCH] [libcxx] [test] Be compatible with LWG 2438 "std::iterator inheritance shouldn't be mandated". In C++17, these iterators are allowed but not required to inherit from the deprecated std::iterator base class. Fixes D32727. llvm-svn: 302318 --- .../istream.iterator/types.pass.cpp | 18 ++++++++++++++++++ .../ostream.iterator/types.pass.cpp | 18 ++++++++++++++++++ .../ostreambuf.iterator/types.pass.cpp | 18 ++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/libcxx/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp b/libcxx/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp index a680aa3f499b..3046ced75a70 100644 --- a/libcxx/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp +++ b/libcxx/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp @@ -40,12 +40,22 @@ #include #include +#include "test_macros.h" + int main() { typedef std::istream_iterator I1; // double is trivially destructible +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); @@ -53,9 +63,17 @@ int main() static_assert( std::is_trivially_destructible::value, ""); typedef std::istream_iterator I2; // unsigned is trivially destructible +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); diff --git a/libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp b/libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp index 460da642bc6e..8d043e1e6347 100644 --- a/libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp +++ b/libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp @@ -23,17 +23,35 @@ #include #include +#include "test_macros.h" + int main() { typedef std::ostream_iterator I1; +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); typedef std::ostream_iterator I2; +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); diff --git a/libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp b/libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp index a699b2419830..cdf74846547d 100644 --- a/libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp +++ b/libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp @@ -24,19 +24,37 @@ #include #include +#include "test_macros.h" + int main() { typedef std::ostreambuf_iterator I1; +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); typedef std::ostreambuf_iterator I2; +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), "");