This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3 PATCH] Implement LWG 2221, No formatted output operator for nullptr


On 03/12/17 23:08 +0200, Ville Voutilainen wrote:
Tested on Linux-x64.

2017-11-14  Ville Voutilainen  <ville.voutilainen@gmail.com>

   Implement LWG 2221
   * include/std/ostream (operator<<(nullptr_t)): New.
   * testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc: New.

diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index f7cab03..18011bc 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -245,6 +245,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
      operator<<(const void* __p)
      { return _M_insert(__p); }

+#if __cplusplus > 201402L
+      __ostream_type&
+      operator<<(nullptr_t)
+      { return *this << "nullptr"; }
+#endif

As discussed on IRC, this requires a new symbol to be exported for the
std::ostream and std::wostream explicit instantiations, or the new
test will fail to link at -O0.

That should wait for stage 1.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]