summaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 18a4dcf988e..f89b4248e65 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2915,7 +2915,7 @@ static tree
build_dtor_call (tree exp, special_function_kind dtor_kind, int flags)
{
tree name;
-
+ tree fn;
switch (dtor_kind)
{
case sfk_complete_destructor:
@@ -2933,8 +2933,13 @@ build_dtor_call (tree exp, special_function_kind dtor_kind, int flags)
default:
abort ();
}
- return build_method_call (exp, name, NULL_TREE,
- TYPE_BINFO (TREE_TYPE (exp)), flags);
+
+ exp = convert_from_reference (exp);
+ fn = lookup_fnfields (TREE_TYPE (exp), name, /*protect=*/2);
+ return build_new_method_call (exp, fn,
+ /*args=*/NULL_TREE,
+ /*conversion_path=*/NULL_TREE,
+ flags);
}
/* Generate a call to a destructor. TYPE is the type to cast ADDR to.