Index: include/ostream =================================================================== --- include/ostream +++ include/ostream @@ -218,6 +218,10 @@ basic_ostream& operator<<(const void* __p); basic_ostream& operator<<(basic_streambuf* __sb); + _LIBCPP_INLINE_VISIBILITY + basic_ostream& operator<<(nullptr_t) + { return *this << "nullptr"; } + // 27.7.2.7 Unformatted output: basic_ostream& put(char_type __c); basic_ostream& write(const char_type* __s, streamsize __n); Index: test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp =================================================================== --- test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp +++ test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp @@ -67,6 +67,13 @@ os << &sb2; assert(sb.str() == "testing..."); } + { // LWG 2221 - nullptr + testbuf sb; + std::ostream os(&sb); + os << nullptr; + assert(sb.str().size() != 0); + LIBCPP_ASSERT(sb.str() == "nullptr"); + } return 0; } Index: www/cxx1z_status.html =================================================================== --- www/cxx1z_status.html +++ www/cxx1z_status.html @@ -364,7 +364,7 @@ 2062Effect contradictions w/o no-throw guarantee of std::function swapsIssaquahComplete 2166Heap property underspecified?Issaquah - 2221No formatted output operator for nullptrIssaquah + 2221No formatted output operator for nullptrIssaquahComplete 2223shrink_to_fit effect on iterator validityIssaquahComplete 2261Are containers required to use their 'pointer' type internally?Issaquah 2394locale::name specification unclear - what is implementation-defined?IssaquahComplete