From f70292772476f1ccc341a69bfb0ab264bc9954bf Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 21 Apr 2011 00:28:25 -0400 Subject: [PATCH] * call.c (build_over_call): Handle trivial dtor. From-SVN: r172809 --- gcc/cp/ChangeLog | 2 ++ gcc/cp/call.c | 6 +++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/init/dtor4.C | 9 +++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/init/dtor4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 879f863bfa4..dcfa7e67a71 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 2011-04-20 Jason Merrill + * call.c (build_over_call): Handle trivial dtor. + * search.c (lookup_fnfields_slot): Call complete_type. PR c++/48594 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 78104b1540b..cf8e1a5d297 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6411,7 +6411,11 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) return val; } - /* FIXME handle trivial default constructor and destructor, too. */ + else if (DECL_DESTRUCTOR_P (fn) + && trivial_fn_p (fn) + && !DECL_DELETED_FN (fn)) + return fold_convert (void_type_node, argarray[0]); + /* FIXME handle trivial default constructor, too. */ if (!already_used) mark_used (fn); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index becce40e7f5..8fd021625ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-04-20 Jason Merrill + + * g++.dg/init/dtor4.C: New. + 2011-04-20 Uros Bizjak PR target/48678 diff --git a/gcc/testsuite/g++.dg/init/dtor4.C b/gcc/testsuite/g++.dg/init/dtor4.C new file mode 100644 index 00000000000..4bca69e4a80 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/dtor4.C @@ -0,0 +1,9 @@ +// { dg-final { scan-assembler-not "_ZN1AD2Ev" } } + +struct A { }; + +int main() +{ + A a; + a.~A(); +} -- 2.30.2