Support was recently added for class-level warmth attributes that are
propagated to member functions. The current implementation ignores
member function templates and this patch fixes that.

gcc/cp/ChangeLog:

        * class.cc (propagate_class_warmth_attribute): fix warmth
          propagation for member function templates
---
 gcc/cp/class.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc
index 6fdb56abfb9..68e0f2e9e13 100644
--- a/gcc/cp/class.cc
+++ b/gcc/cp/class.cc
@@ -7805,8 +7805,13 @@ propagate_class_warmth_attribute (tree t)

   if (class_has_cold_attr || class_has_hot_attr)
     for (tree f = TYPE_FIELDS (t); f; f = DECL_CHAIN (f))
-      if (TREE_CODE (f) == FUNCTION_DECL)
-maybe_propagate_warmth_attributes (f, t);
+      {
+tree real_f = f;
+if (TREE_CODE (f) == TEMPLATE_DECL)
+  real_f = DECL_TEMPLATE_RESULT (f);
+if (TREE_CODE (real_f) == FUNCTION_DECL)
+  maybe_propagate_warmth_attributes (real_f, t);
+      }
 }

 tree
--
2.40.0
This e-mail and any attachments may contain information that is confidential 
and proprietary and otherwise protected from disclosure. If you are not the 
intended recipient of this e-mail, do not read, duplicate or redistribute it by 
any means. Please immediately delete it and any attachments and notify the 
sender that you have received it by mistake. Unintended recipients are 
prohibited from taking action on the basis of information in this e-mail or any 
attachments. The DRW Companies make no representations that this e-mail or any 
attachments are free of computer viruses or other defects.

Reply via email to