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);
+ if (DECL_DECLARES_FUNCTION_P (f))
+ maybe_propagate_warmth_attributes (STRIP_TEMPLATE (f), t);
}
tree
/* { dg-options "-O0 -Wattributes -fdump-tree-gimple" } */
-struct __attribute((cold)) A { __attribute((noinline, used)) void foo(void) { } };
-
-struct __attribute((hot)) B { __attribute((noinline, used)) void foo(void) { } };
+struct __attribute((cold)) A {
+ __attribute((noinline, used)) void foo(void) { }
+ template <class T> void bar() {}
+};
+template void A::bar<int>();
+
+struct __attribute((hot)) B {
+ __attribute((noinline, used)) void foo(void) { }
+ template <class T> void bar() {}
+};
+template void B::bar<int>();
struct __attribute((hot, cold)) C { __attribute((noinline, used)) void foo(void) { } }; /* { dg-warning "ignoring attribute .cold. because it conflicts with attribute .hot." } */
struct __attribute((cold, hot)) D { __attribute((noinline, used)) void foo(void) { } }; /* { dg-warning "ignoring attribute .hot. because it conflicts with attribute .cold." } */
-/* { dg-final { scan-tree-dump-times "cold" 2 "gimple" } } */
-/* { dg-final { scan-tree-dump-times "hot" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "cold" 3 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "hot" 3 "gimple" } } */