summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorville <ville@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-18 15:17:09 +0000
committerville <ville@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-18 15:17:09 +0000
commit89da6832f8e77b747ee676d0849d09e5382ef69c (patch)
tree3a8a381d19ed873a3737382ce8497fdea199988f /libstdc++-v3
parent31a633e47c58a2115880d1338705505cf6860160 (diff)
downloadgcc-89da6832f8e77b747ee676d0849d09e5382ef69c.tar.gz
2015-12-18 Ville Voutilainen <ville.voutilainen@gmail.com>
PR libstdc++/68276 * src/c++11/ios.cc (_M_grow_words): Use nothrow new. * testsuite/27_io/ios_base/storage/11584.cc: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231819 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/src/c++11/ios.cc5
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc8
3 files changed, 13 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 6a8fa76fa04..a37878d7867 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-18 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ PR libstdc++/68276
+
+ * src/c++11/ios.cc (_M_grow_words): Use nothrow new.
+ * testsuite/27_io/ios_base/storage/11584.cc: Adjust.
+
2015-12-18 Andris Pavenis <andris.pavenis@iki.fi>
* config/os/djgpp/error_constants.h: update according to DJGPP errno
diff --git a/libstdc++-v3/src/c++11/ios.cc b/libstdc++-v3/src/c++11/ios.cc
index 4adc7019293..f701e61f0d0 100644
--- a/libstdc++-v3/src/c++11/ios.cc
+++ b/libstdc++-v3/src/c++11/ios.cc
@@ -121,9 +121,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__ix < numeric_limits<int>::max())
{
__newsize = __ix + 1;
- __try
- { __words = new _Words[__newsize]; }
- __catch(const std::bad_alloc&)
+ __words = new (std::nothrow) _Words[__newsize];
+ if (!__words)
{
_M_streambuf_state |= badbit;
if (_M_streambuf_state & _M_exception)
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
index 0c80795dfde..ae680c7d7bf 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
@@ -26,14 +26,14 @@
int new_fails;
-void* operator new(std::size_t n) throw (std::bad_alloc)
+void* operator new(std::size_t n, const std::nothrow_t&) throw()
{
if (new_fails)
- throw std::bad_alloc();
+ return 0;
return malloc(n);
}
-void* operator new[] (std::size_t n) throw (std::bad_alloc)
-{ return operator new(n); }
+void* operator new[] (std::size_t n, const std::nothrow_t& ntt) throw()
+{ return operator new(n, ntt); }
void operator delete (void *p) throw() { free(p); }
void operator delete[] (void *p) throw() { operator delete(p); }