aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-02-15 12:19:45 -0500
committerJason Merrill <jason@gcc.gnu.org>2013-02-15 12:19:45 -0500
commit52d95c2127d392462f88ae5ca87358f81c514e2c (patch)
treee92070b77cd26fb76a9520fcedb563c2ed8fedc3 /gcc
parent30fa2a51fabf5147e339ed2f93ab446a99e3b2b9 (diff)
downloadgcc-52d95c2127d392462f88ae5ca87358f81c514e2c.zip
gcc-52d95c2127d392462f88ae5ca87358f81c514e2c.tar.gz
gcc-52d95c2127d392462f88ae5ca87358f81c514e2c.tar.bz2
re PR c++/56343 ([C++11] Destructor defaulted on first declaration has wrong implicit exception specification)
PR c++/56343 * class.c (check_bases_and_members): Deduce noexcept after checking bases. From-SVN: r196082
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/class.c9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted41.C14
3 files changed, 23 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 70dcc20..2dab029 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2013-02-15 Jason Merrill <jason@redhat.com>
+ PR c++/56343
+ * class.c (check_bases_and_members): Deduce noexcept after
+ checking bases.
+
PR c++/52026
* semantics.c (finish_id_expression): In a template, return
the identifier for a constant variable.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 38339f2..eaa109a 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5245,14 +5245,15 @@ check_bases_and_members (tree t)
cant_have_const_ctor = 0;
no_const_asn_ref = 0;
- /* Deduce noexcept on destructors. */
- if (cxx_dialect >= cxx0x)
- deduce_noexcept_on_destructors (t);
-
/* Check all the base-classes. */
check_bases (t, &cant_have_const_ctor,
&no_const_asn_ref);
+ /* Deduce noexcept on destructors. This needs to happen after we've set
+ triviality flags appropriately for our bases. */
+ if (cxx_dialect >= cxx0x)
+ deduce_noexcept_on_destructors (t);
+
/* Check all the method declarations. */
check_methods (t);
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted41.C b/gcc/testsuite/g++.dg/cpp0x/defaulted41.C
new file mode 100644
index 0000000..4272012
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted41.C
@@ -0,0 +1,14 @@
+// PR c++/56343
+// { dg-do compile { target c++11 } }
+
+class B
+{
+public:
+ virtual ~B() noexcept(false) { }
+};
+
+class D : public B
+{
+public:
+ virtual ~D() = default;
+};