aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-03-14 21:39:03 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-03-14 21:39:03 -0400
commit47b5d284dd6aa3281f79d973e3194ab9d6990a45 (patch)
tree92b4739ea80c9bbf8214849710abff39696907f8 /gcc/cp
parent265a9ea76322a9b0a4c30a86cdd8833723d166fa (diff)
downloadgcc-47b5d284dd6aa3281f79d973e3194ab9d6990a45.zip
gcc-47b5d284dd6aa3281f79d973e3194ab9d6990a45.tar.gz
gcc-47b5d284dd6aa3281f79d973e3194ab9d6990a45.tar.bz2
re PR c++/60532 (r208573 causes Firefox build failure)
PR c++/60532 PR c++/58678 * search.c (get_pure_virtuals): Handle abstract dtor here. (dfs_get_pure_virtuals): Not here. From-SVN: r208586
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/search.c32
2 files changed, 21 insertions, 16 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b752ebe..ca2f8c1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2014-03-14 Jason Merrill <jason@redhat.com>
+ PR c++/60532
+ PR c++/58678
+ * search.c (get_pure_virtuals): Handle abstract dtor here.
+ (dfs_get_pure_virtuals): Not here.
+
PR c++/58678
* search.c (dfs_get_pure_virtuals): Treat the destructor of an
abstract class as pure.
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 66c6df5..d99e182 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -2096,22 +2096,6 @@ dfs_get_pure_virtuals (tree binfo, void *data)
if (DECL_PURE_VIRTUAL_P (BV_FN (virtuals)))
vec_safe_push (CLASSTYPE_PURE_VIRTUALS (type), BV_FN (virtuals));
}
- /* Treat a virtual destructor in an abstract class as pure even if it
- isn't declared as pure; there is no way it would be called through the
- vtable except during construction, which causes undefined behavior. */
- if (binfo == TYPE_BINFO (type)
- && CLASSTYPE_PURE_VIRTUALS (type)
- && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
- {
- tree dtor = CLASSTYPE_DESTRUCTORS (type);
- if (DECL_VIRTUAL_P (dtor) && !DECL_PURE_VIRTUAL_P (dtor))
- {
- tree clone;
- DECL_PURE_VIRTUAL_P (dtor) = true;
- FOR_EACH_CLONE (clone, dtor)
- DECL_PURE_VIRTUAL_P (clone) = true;
- }
- }
return NULL_TREE;
}
@@ -2131,6 +2115,22 @@ get_pure_virtuals (tree type)
which it is a primary base will contain vtable entries for the
pure virtuals in the base class. */
dfs_walk_once (TYPE_BINFO (type), NULL, dfs_get_pure_virtuals, type);
+
+ /* Treat a virtual destructor in an abstract class as pure even if it
+ isn't declared as pure; there is no way it would be called through the
+ vtable except during construction, which causes undefined behavior. */
+ if (CLASSTYPE_PURE_VIRTUALS (type)
+ && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
+ {
+ tree dtor = CLASSTYPE_DESTRUCTORS (type);
+ if (dtor && DECL_VIRTUAL_P (dtor) && !DECL_PURE_VIRTUAL_P (dtor))
+ {
+ tree clone;
+ DECL_PURE_VIRTUAL_P (dtor) = true;
+ FOR_EACH_CLONE (clone, dtor)
+ DECL_PURE_VIRTUAL_P (clone) = true;
+ }
+ }
}
/* Debug info for C++ classes can get very large; try to avoid