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
This commit is contained in:
parent
ca32b47320
commit
76178f6767
|
@ -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
|
||||
|
|
15
gcc/cp/pt.c
15
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue