public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [v3 PATCH] Implement LWG 2221, No formatted output operator for nullptr
@ 2017-12-03 21:08 Ville Voutilainen
  2017-12-04 23:04 ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Ville Voutilainen @ 2017-12-03 21:08 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

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.

[-- Attachment #2: lwg2221.diff --]
[-- Type: text/plain, Size: 1013 bytes --]

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
+
       /**
        *  @brief  Extracting from another streambuf.
        *  @param  __sb  A pointer to a streambuf
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc
new file mode 100644
index 0000000..1ffacb3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc
@@ -0,0 +1,9 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+#include <iostream>
+
+int main()
+{
+  std::cout << nullptr << std::endl;
+}

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-01-11 11:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-03 21:08 [v3 PATCH] Implement LWG 2221, No formatted output operator for nullptr Ville Voutilainen
2017-12-04 23:04 ` Jonathan Wakely
2019-01-10 13:15   ` Jonathan Wakely
2019-01-10 21:27     ` Rainer Orth
2019-01-11  0:01       ` Jonathan Wakely
2019-01-11  9:07         ` Rainer Orth
2019-01-11 11:01           ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).