aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2004-01-27 23:41:16 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2004-01-27 23:41:16 +0000
commit62b21ea0fca95b23e9a5f3b5823ece85bea133d4 (patch)
tree68297dfc5421c328bd36fc9d002ccd249365d33e /libstdc++-v3
parent826b47cc77a9b9ffb6489fd361be217cb024313f (diff)
downloadgcc-62b21ea0fca95b23e9a5f3b5823ece85bea133d4.zip
gcc-62b21ea0fca95b23e9a5f3b5823ece85bea133d4.tar.gz
gcc-62b21ea0fca95b23e9a5f3b5823ece85bea133d4.tar.bz2
11584.cc: Correct new and delete declarations, add include and test variable.
2004-01-27 Benjamin Kosnik <bkoz@redhat.com> * testsuite/27_io/ios_base/storage/11584.cc: Correct new and delete declarations, add include and test variable. From-SVN: r76766
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc52
2 files changed, 32 insertions, 25 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0d03771..6fb3dd4 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-27 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/27_io/ios_base/storage/11584.cc: Correct new and
+ delete declarations, add include and test variable.
+
2003-01-27 Jerry Quinn <jlquinn@optonline.net>
* include/bits/codecvt.h, include/bits/locale_facets.h,
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 8b1a7a7..0df9c0c 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
@@ -22,40 +22,42 @@
#include <cstdlib>
#include <new>
+#include <iostream>
#include <testsuite_hooks.h>
int new_fails;
-void* operator new (size_t n)
+void* operator new(std::size_t n) throw (std::bad_alloc)
{
- if (new_fails)
- throw std::bad_alloc();
-
- return malloc(n);
+ if (new_fails)
+ throw std::bad_alloc();
+ return malloc(n);
}
+void* operator new[] (std::size_t n) throw (std::bad_alloc)
+{ return operator new(n); }
-void operator delete (void *p) { free(p); }
-void* operator new[] (size_t n) { return operator new(n); }
-void operator delete[] (void *p) { operator delete(p); }
+void operator delete (void *p) throw() { free(p); }
+void operator delete[] (void *p) throw() { operator delete(p); }
int main ()
{
- const int i = std::ios::xalloc ();
-
- new_fails = 1;
-
- // Successive accesses to failure storage clears to zero.
- std::cout.iword(100) = 0xdeadbeef;
- VERIFY(std::cout.iword(100) == 0);
-
- // Access to pword failure storage shouldn't clear iword pword storage.
- long& lr = std::cout.iword(100);
- lr = 0xdeadbeef;
-
- void* pv = std::cout.pword(100);
- VERIFY(pv == 0);
- VERIFY(lr == 0xdeadbeef);
-
- return 0;
+ bool test __attribute__((unused)) = true;
+ const int i = std::ios::xalloc ();
+
+ new_fails = 1;
+
+ // Successive accesses to failure storage clears to zero.
+ std::cout.iword(100) = 0xdeadbeef;
+ VERIFY(std::cout.iword(100) == 0);
+
+ // Access to pword failure storage shouldn't clear iword pword storage.
+ long& lr = std::cout.iword(100);
+ lr = 0xdeadbeef;
+
+ void* pv = std::cout.pword(100);
+ VERIFY(pv == 0);
+ VERIFY(lr == 0xdeadbeef);
+
+ return 0;
}