diff --git a/libcxx/include/ostream b/libcxx/include/ostream --- a/libcxx/include/ostream +++ b/libcxx/include/ostream @@ -210,6 +210,13 @@ basic_ostream& operator<<(double __f); basic_ostream& operator<<(long double __f); basic_ostream& operator<<(const void* __p); + +#if _LIBCPP_STD_VER > 20 + _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(const volatile void* __val) { + return operator<<(const_cast(__val)); + } +#endif + basic_ostream& operator<<(basic_streambuf* __sb); _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp --- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp @@ -67,6 +67,14 @@ assert(os1.good()); std::string s1(sb1.str()); +#if TEST_STD_VER > 20 + testbuf sb3; + std::ostream os3(&sb3); + os3 << static_cast(&n1); + assert(os3.good()); + std::string s3(sb3.str()); +#endif + testbuf sb2; std::ostream os2(&sb2); int n2; @@ -74,6 +82,14 @@ assert(os2.good()); std::string s2(sb2.str()); +#if TEST_STD_VER > 20 + testbuf sb4; + std::ostream os4(&sb4); + os4 << static_cast(&n2); + assert(os4.good()); + std::string s4(sb4.str()); +#endif + // %p is implementation defined. Instead of validating the // output, at least ensure that it does not generate an empty // string. Also make sure that given two distinct addresses, the @@ -81,6 +97,15 @@ assert(!s1.empty()); assert(!s2.empty()); assert(s1 != s2); + +#if TEST_STD_VER > 20 + assert(!s3.empty()); + assert(!s4.empty()); + assert(s3 != s4); + + assert(s1 == s3); + assert(s2 == s4); +#endif } { testbuf sb;