11584.cc: Correct new and delete declarations, add include and test variable.
authorBenjamin Kosnik <bkoz@redhat.com>
Tue, 27 Jan 2004 23:41:16 +0000 (23:41 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 27 Jan 2004 23:41:16 +0000 (23:41 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc

index 0d03771..6fb3dd4 100644 (file)
@@ -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,
index 8b1a7a7..0df9c0c 100644 (file)
 
 #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;
 }