* call.c (build_over_call): Handle trivial dtor.
authorJason Merrill <jason@redhat.com>
Thu, 21 Apr 2011 04:28:25 +0000 (00:28 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 21 Apr 2011 04:28:25 +0000 (00:28 -0400)
From-SVN: r172809

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/dtor4.C [new file with mode: 0644]

index 879f863bfa4ac0b1f2554c141e14ddf9b71786f5..dcfa7e67a71ce05dbbfe61f95d54f9fa33e5ca84 100644 (file)
@@ -1,5 +1,7 @@
 2011-04-20  Jason Merrill  <jason@redhat.com>
 
+       * call.c (build_over_call): Handle trivial dtor.
+
        * search.c (lookup_fnfields_slot): Call complete_type.
 
        PR c++/48594
index 78104b1540b768192ce1173afdb614f3d3010792..cf8e1a5d29736090c6fd19ef4f1fd8adaab3efa9 100644 (file)
@@ -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);
index becce40e7f51ba52fcce30b52399baff25b07137..8fd021625ac6b95d50001ab37d4c744c15949366 100644 (file)
@@ -1,3 +1,7 @@
+2011-04-20  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/init/dtor4.C: New.
+
 2011-04-20  Uros Bizjak  <ubizjak@gmail.com>
 
        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 (file)
index 0000000..4bca69e
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-final { scan-assembler-not "_ZN1AD2Ev" } }
+
+struct A { };
+
+int main()
+{
+  A a;
+  a.~A();
+}