From 48e968a72081812d4e0c271b5397fbffa2ba7e3a Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 23 Sep 2014 14:17:42 +0100 Subject: [PATCH] gnu.ver: Adjust basic_ostream exports. * config/abi/pre/gnu.ver: Adjust basic_ostream exports. * include/std/istream (basic_iostream(basic_iostream&&)): Pass *this to ostream constructor. * include/std/ostream (basic_ostream(basic_iostream*)): Change to take parameter by reference, to avoid ambiguity. * testsuite/27_io/basic_ostream/cons/char/null.cc: New. From-SVN: r215510 --- libstdc++-v3/ChangeLog | 9 ++++++ libstdc++-v3/config/abi/pre/gnu.ver | 6 ++-- libstdc++-v3/include/std/istream | 2 +- libstdc++-v3/include/std/ostream | 2 +- .../27_io/basic_ostream/cons/char/null.cc | 30 +++++++++++++++++++ 5 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 libstdc++-v3/testsuite/27_io/basic_ostream/cons/char/null.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f06ae8ef15f..5edfaff4d95 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2014-09-23 Jonathan Wakely + + * config/abi/pre/gnu.ver: Adjust basic_ostream exports. + * include/std/istream (basic_iostream(basic_iostream&&)): Pass *this + to ostream constructor. + * include/std/ostream (basic_ostream(basic_iostream*)): Change to take + parameter by reference, to avoid ambiguity. + * testsuite/27_io/basic_ostream/cons/char/null.cc: New. + 2014-09-22 Jason Merrill * testsuite/Makefile.am (%/site.exp): Add @. diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 669e36d7ece..58c90d681ab 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -1413,9 +1413,9 @@ GLIBCXX_3.4.21 { _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEaSEOS3_; _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEC[12]EOS3_; - # basic_ostream::basic_ostream(basic_iostream*) - _ZNSoC[12]EPSd; - _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]EPSt14basic_iostreamIwS1_E; + # basic_ostream::basic_ostream(basic_iostream&) + _ZNSoC[12]ERSd; + _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]ERSt14basic_iostreamIwS1_E; } GLIBCXX_3.4.20; diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream index 3a4761624e2..d4e5d71177e 100644 --- a/libstdc++-v3/include/std/istream +++ b/libstdc++-v3/include/std/istream @@ -863,7 +863,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_iostream(const basic_iostream&) = delete; basic_iostream(basic_iostream&& __rhs) - : __istream_type(std::move(__rhs)), __ostream_type(this) + : __istream_type(std::move(__rhs)), __ostream_type(*this) { } // 27.7.3.3 Assign/swap diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream index 748b805ee7d..619dbe4cd22 100644 --- a/libstdc++-v3/include/std/ostream +++ b/libstdc++-v3/include/std/ostream @@ -386,7 +386,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L // Non-standard constructor that does not call init() - basic_ostream(basic_iostream<_CharT, _Traits>*) { } + basic_ostream(basic_iostream<_CharT, _Traits>&) { } basic_ostream(const basic_ostream&) = delete; diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/cons/char/null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/cons/char/null.cc new file mode 100644 index 00000000000..6e41c4076a0 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/cons/char/null.cc @@ -0,0 +1,30 @@ +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include + +// https://gcc.gnu.org/ml/libstdc++/2014-09/msg00108.html +struct O : std::ostream +{ + O() : std::ostream(NULL) { } + O(int) : std::ostream(nullptr) { } +}; + +O o; -- 2.30.2