OSDN Git Service

2010-05-07 Jonathan Wakely <jwakely.gcc@gmail.com>
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 May 2010 01:05:38 +0000 (01:05 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 May 2010 01:05:38 +0000 (01:05 +0000)
* libsupc++/exception_ptr.h (make_exception_ptr): Add.
* testsuite/18_support/exception_ptr/make_exception_ptr.cc: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159144 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/libsupc++/exception_ptr.h
libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc [new file with mode: 0644]

index 652e589..6129434 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-07  Jonathan Wakely  <jwakely.gcc@gmail.com>
+
+       * libsupc++/exception_ptr.h (make_exception_ptr): Add.
+       * testsuite/18_support/exception_ptr/make_exception_ptr.cc: New.
+
 2010-05-06  Jason Merrill  <jason@redhat.com>
 
        * config/abi/pre/gnu.ver: Move decltype(nullptr) into CXXABI_1.3.5.
index 3ee4d8d..f3f0819 100644 (file)
@@ -160,6 +160,14 @@ namespace std
        }
     }
 
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // 1130. copy_exception name misleading
+  /// Obtain an exception_ptr pointing to a copy of the supplied object.
+  template<typename _Ex>
+    exception_ptr 
+    make_exception_ptr(_Ex __ex) throw()
+    { return std::copy_exception<_Ex>(__ex); }
+
   // @} group exceptions
 } // namespace std
 
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc
new file mode 100644 (file)
index 0000000..bc16ccd
--- /dev/null
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2010 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
+// <http://www.gnu.org/licenses/>.
+
+#include <exception>
+#include <testsuite_hooks.h>
+
+bool test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::exception_ptr p = std::make_exception_ptr(0);
+
+  VERIFY( !(p == 0) );
+}
+
+int main()
+{
+  test01();
+
+  return 0;
+}