From e59d098825af9f320e9d8b1140f6e15c0846d463 Mon Sep 17 00:00:00 2001 From: Volodymyr Sapsai Date: Wed, 19 Sep 2018 23:31:34 +0000 Subject: [PATCH] Revert "Implement LWG 2221 - No formatted output operator for nullptr." This reverts r342566 as it causes on bots linker errors like > Undefined symbols for architecture i386: > "std::__1::basic_ostream >::operator<<(std::nullptr_t)", referenced from: git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342599 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/ostream | 11 +-- .../ostream.inserters/nullptr.pass.cpp | 80 ------------------- www/cxx1z_status.html | 4 +- 3 files changed, 3 insertions(+), 92 deletions(-) delete mode 100644 test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/nullptr.pass.cpp diff --git a/include/ostream b/include/ostream index c29157077..5404e0dca 100644 --- a/include/ostream +++ b/include/ostream @@ -56,7 +56,6 @@ public: basic_ostream& operator<<(double f); basic_ostream& operator<<(long double f); basic_ostream& operator<<(const void* p); - basic_ostream& operator<<(nullptr_t); // C++17 basic_ostream& operator<<(basic_streambuf* sb); // 27.7.2.7 Unformatted output: @@ -217,7 +216,6 @@ public: basic_ostream& operator<<(double __f); basic_ostream& operator<<(long double __f); basic_ostream& operator<<(const void* __p); - basic_ostream& operator<<(nullptr_t); basic_ostream& operator<<(basic_streambuf* __sb); // 27.7.2.7 Unformatted output: @@ -711,14 +709,6 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n) return *this; } -template -basic_ostream<_CharT, _Traits>& -basic_ostream<_CharT, _Traits>::operator<<(nullptr_t) -{ - return *this << "(nullptr)"; -} - - template basic_ostream<_CharT, _Traits>& __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, @@ -752,6 +742,7 @@ __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, return __os; } + template basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c) diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/nullptr.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/nullptr.pass.cpp deleted file mode 100644 index 0893b2b07..000000000 --- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/nullptr.pass.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template > -// class basic_ostream; - -// template -// basic_ostream& operator<<(basic_ostream& out, nullptr_t); -// - -#include -#include -#include "test_macros.h" - -template -class testbuf - : public std::basic_streambuf -{ - typedef std::basic_streambuf base; - std::basic_string str_; -public: - testbuf() - { - } - - std::basic_string str() const - {return std::basic_string(base::pbase(), base::pptr());} - -protected: - - virtual typename base::int_type - overflow(typename base::int_type ch = base::traits_type::eof()) - { - if (ch != base::traits_type::eof()) - { - int n = static_cast(str_.size()); - str_.push_back(ch); - str_.resize(str_.capacity()); - base::setp(const_cast(str_.data()), - const_cast(str_.data() + str_.size())); - base::pbump(n+1); - } - return ch; - } -}; - -int main() -{ - { - std::wostream os((std::wstreambuf*)0); - os << nullptr; - assert(os.bad()); - assert(os.fail()); - } - { - testbuf sb; - std::ostream os(&sb); - assert(sb.str().length() == 0); - os << nullptr; - assert(sb.str().length() > 0); - LIBCPP_ASSERT(sb.str() == "(nullptr)"); // output is an implementation-defined NTCTS - } - - { - testbuf sb; - std::wostream os(&sb); - assert(sb.str().length() == 0); - os << nullptr; - assert(sb.str().length() > 0); - LIBCPP_ASSERT(sb.str() == L"(nullptr)"); // output is an implementation-defined NTCTS - } -} diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index c54a12f99..6f3da4792 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -365,7 +365,7 @@ 2062Effect contradictions w/o no-throw guarantee of std::function swapsIssaquahComplete 2166Heap property underspecified?Issaquah - 2221No formatted output operator for nullptrIssaquahComplete + 2221No formatted output operator for nullptrIssaquah 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 @@ -504,7 +504,7 @@ -

Last Updated: 19-Sep-2018

+

Last Updated: 3-Aug-2018