aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@gmail.com>2015-12-11 12:04:23 +0000
committerVille Voutilainen <ville.voutilainen@gmail.com>2015-12-11 12:04:23 +0000
commit9c147087d6b7e1ba3a0872e1ad5f19f4233e29cd (patch)
tree172f7457c7f33fe04227fbf6aa7dc964851b90b0
parent1f4833d603489e32fcf96f0760fd13144dff11ce (diff)
PR libstdc++/68139
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231562 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/libsupc++/nested_exception.h4
-rw-r--r--libstdc++-v3/testsuite/18_support/nested_exception/68139.cc31
3 files changed, 41 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 3fc7f579b6f..f982946a757 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-11 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ PR libstdc++/68139
+
+ * libsupc++/nested_exception.h (_S_rethrow): Use std::__addressof.
+ * testsuite/18_support/nested_exception/68139.cc: New.
+
2015-12-10 Jonathan Wakely <jwakely@redhat.com>
* testsuite/experimental/memory/shared_ptr/assign/assign.cc: Replace
diff --git a/libstdc++-v3/libsupc++/nested_exception.h b/libstdc++-v3/libsupc++/nested_exception.h
index a716f75adf4..82b95df27ae 100644
--- a/libstdc++-v3/libsupc++/nested_exception.h
+++ b/libstdc++-v3/libsupc++/nested_exception.h
@@ -37,6 +37,7 @@
#else
#include <bits/c++config.h>
+#include <bits/move.h>
#if ATOMIC_INT_LOCK_FREE < 2
# error This platform does not support exception propagation.
@@ -142,7 +143,8 @@ namespace std
{
static void _S_rethrow(const _Tp& __t)
{
- if (auto __tp = dynamic_cast<const nested_exception*>(&__t))
+ if (auto __tp =
+ dynamic_cast<const nested_exception*>(std::__addressof(__t)))
__tp->rethrow_nested();
}
};
diff --git a/libstdc++-v3/testsuite/18_support/nested_exception/68139.cc b/libstdc++-v3/testsuite/18_support/nested_exception/68139.cc
new file mode 100644
index 00000000000..551f9312423
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/nested_exception/68139.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2015 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++/68139
+struct C {
+ virtual ~C(){}
+ void operator&() const = delete;
+};
+
+int main() { std::rethrow_if_nested(C()); }
+