diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2009-06-03 10:37:20 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2009-06-03 10:37:20 +0000 |
commit | 110a123aae0196680d42ace6e3899304ceba4d1d (patch) | |
tree | c3568ccf621b03599044de8ca5b322f78fc7a78d /libstdc++-v3/testsuite | |
parent | 8cd281486b0025bd3a6f7f000e24be4a8d231e22 (diff) | |
download | gcc-110a123aae0196680d42ace6e3899304ceba4d1d.tar.gz |
re PR libstdc++/40296 ([C++0x] std::exception_ptr comparisons)
2009-06-03 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/40296
* libsupc++/exception_ptr.h (exception_ptr::operator!,
exception_ptr::operator __safe_bool): Only declare when
_GLIBCXX_EH_PTR_COMPAT is undefined.
* libsupc++/eh_ptr.cc: Define _GLIBCXX_EH_PTR_COMPAT before including
exception_ptr.
* testsuite/18_support/exception_ptr/40296.cc: New.
* testsuite/18_support/nested_exception/throw_with_nested.cc: Adjust.
* testsuite/18_support/nested_exception/cons.cc: Likewise.
* testsuite/18_support/nested_exception/nested_ptr.cc: Likewise.
* testsuite/18_support/exception_ptr/current_exception.cc: Likewise.
From-SVN: r148122
Diffstat (limited to 'libstdc++-v3/testsuite')
5 files changed, 37 insertions, 7 deletions
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/40296.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/40296.cc new file mode 100644 index 00000000000..933f4136956 --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/exception_ptr/40296.cc @@ -0,0 +1,30 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-atomic-builtins "" } + +// Copyright (C) 2009 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> + +// libstdc++/40296 +bool test01() +{ + std::exception_ptr p; + + return (p == 0); +} diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc index ec06b336f1e..4029eaf69e3 100644 --- a/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc +++ b/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc @@ -31,7 +31,7 @@ void test01() using namespace std; exception_ptr ep = current_exception(); - VERIFY( !ep ); + VERIFY( ep == 0 ); } void test02() @@ -43,7 +43,7 @@ void test02() throw 0; } catch(...) { exception_ptr ep = current_exception(); - VERIFY( ep ); + VERIFY( ep != 0 ); } } @@ -56,7 +56,7 @@ void test03() throw exception(); } catch(std::exception&) { exception_ptr ep = current_exception(); - VERIFY( ep ); + VERIFY( ep != 0 ); } } diff --git a/libstdc++-v3/testsuite/18_support/nested_exception/cons.cc b/libstdc++-v3/testsuite/18_support/nested_exception/cons.cc index dcbd36ec7e2..3dc67fb98b1 100644 --- a/libstdc++-v3/testsuite/18_support/nested_exception/cons.cc +++ b/libstdc++-v3/testsuite/18_support/nested_exception/cons.cc @@ -27,7 +27,7 @@ void test01() std::nested_exception e; - VERIFY( !e.nested_ptr() ); + VERIFY( e.nested_ptr() == 0 ); } void test02() diff --git a/libstdc++-v3/testsuite/18_support/nested_exception/nested_ptr.cc b/libstdc++-v3/testsuite/18_support/nested_exception/nested_ptr.cc index 5a3ab62070e..d016436d017 100644 --- a/libstdc++-v3/testsuite/18_support/nested_exception/nested_ptr.cc +++ b/libstdc++-v3/testsuite/18_support/nested_exception/nested_ptr.cc @@ -31,7 +31,7 @@ void test01() } catch (const std::nested_exception& e) { - VERIFY( !e.nested_ptr() ); + VERIFY( e.nested_ptr() == 0 ); } } diff --git a/libstdc++-v3/testsuite/18_support/nested_exception/throw_with_nested.cc b/libstdc++-v3/testsuite/18_support/nested_exception/throw_with_nested.cc index a4f05f09f30..9ce31f06f03 100644 --- a/libstdc++-v3/testsuite/18_support/nested_exception/throw_with_nested.cc +++ b/libstdc++-v3/testsuite/18_support/nested_exception/throw_with_nested.cc @@ -35,7 +35,7 @@ void test01() } catch (const std::nested_exception& e) { - VERIFY( !e.nested_ptr() ); + VERIFY( e.nested_ptr() == 0 ); try { throw; @@ -58,7 +58,7 @@ void test02() } catch (const std::nested_exception& e) { - VERIFY( !e.nested_ptr() ); + VERIFY( e.nested_ptr() == 0 ); try { throw; |