aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-07-23 22:19:46 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-07-23 22:19:46 -0400
commit76178f67679d1a13ef472795c47547378fa67b40 (patch)
tree8630907a09efca34d7da906c3dfb5d617c9ffe83 /gcc
parentca32b473206935d4cb8bce200a75606d17840e03 (diff)
downloadgcc-76178f67679d1a13ef472795c47547378fa67b40.zip
gcc-76178f67679d1a13ef472795c47547378fa67b40.tar.gz
gcc-76178f67679d1a13ef472795c47547378fa67b40.tar.bz2
PR c++/71748 - call to base destructor in template.
PR c++/52746 * pt.c (tsubst_baselink): Call adjust_result_of_qualified_name_lookup for unqualified destructors. From-SVN: r238681
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/pt.c15
-rw-r--r--gcc/testsuite/g++.dg/template/dtor10.C23
3 files changed, 42 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a3cc081..75d9108 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2016-07-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/71748
+ PR c++/52746
+ * pt.c (tsubst_baselink): Call
+ adjust_result_of_qualified_name_lookup for unqualified
+ destructors.
+
2016-07-21 Jason Merrill <jason@redhat.com>
PR c++/69223
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 5e29d99..3ee53d1 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13760,10 +13760,17 @@ tsubst_baselink (tree baselink, tree object_type,
if (!object_type)
object_type = current_class_type;
- if (qualified)
- baselink = adjust_result_of_qualified_name_lookup (baselink,
- qualifying_scope,
- object_type);
+ if (qualified || name == complete_dtor_identifier)
+ {
+ baselink = adjust_result_of_qualified_name_lookup (baselink,
+ qualifying_scope,
+ object_type);
+ if (!qualified)
+ /* We need to call adjust_result_of_qualified_name_lookup in case the
+ destructor names a base class, but we unset BASELINK_QUALIFIED_P
+ so that we still get virtual function binding. */
+ BASELINK_QUALIFIED_P (baselink) = false;
+ }
return baselink;
}
diff --git a/gcc/testsuite/g++.dg/template/dtor10.C b/gcc/testsuite/g++.dg/template/dtor10.C
new file mode 100644
index 0000000..4307a68
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dtor10.C
@@ -0,0 +1,23 @@
+// PR c++/71748
+
+struct A
+{
+ virtual ~A () {}
+};
+
+struct B : public A
+{
+ virtual ~B () {}
+};
+
+template < int > void foo ()
+{
+ B *b = new B;
+ b->~A ();
+}
+
+int main ()
+{
+ foo < 0 > ();
+ return 0;
+}