On 10/25/2013 03:04 PM, Jason Merrill wrote:
In C++ all classes have destructors, but we try to defer building the
implicit declaration.  My patch causes us to build those implicit
declarations more often, which is probably a bit of a memory regression,

We can still avoid doing this in C++98 mode.

Tested x86_64-pc-linux-gnu, applying to trunk.

commit 7b8a53224af20adaa67a3df38523fcc0051cec3d
Author: Jason Merrill <ja...@redhat.com>
Date:   Thu Oct 31 09:39:54 2013 -0400

    	* class.c (type_build_ctor_call): Return early in C++98 mode.
    	(type_build_dtor_call): Likewise.

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 43f90d7..64681ba 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5163,6 +5163,8 @@ type_build_ctor_call (tree t)
     return false;
   if (!TYPE_HAS_DEFAULT_CONSTRUCTOR (inner))
     return true;
+  if (cxx_dialect < cxx11)
+    return false;
   /* A user-declared constructor might be private, and a constructor might
      be trivial but deleted.  */
   for (tree fns = lookup_fnfields_slot (inner, complete_ctor_identifier);
@@ -5188,6 +5190,8 @@ type_build_dtor_call (tree t)
   if (!CLASS_TYPE_P (inner) || ANON_AGGR_TYPE_P (inner)
       || !COMPLETE_TYPE_P (inner))
     return false;
+  if (cxx_dialect < cxx11)
+    return false;
   /* A user-declared destructor might be private, and a destructor might
      be trivial but deleted.  */
   for (tree fns = lookup_fnfields_slot (inner, complete_dtor_identifier);

Reply via email to