On 8/11/23 09:18, Javier Martinez wrote:
Hi Jason,
Regarding the initialization example - no, the set of classes that we
consider cold is more loosely defined.
On Thu, Aug 10, 2023 at 11:01 PM Jason Merrill <ja...@redhat.com
<mailto:ja...@redhat.com>> wrote:
> Yes, but that's because the implicit op== isn't declared lazily like
> some other special member functions (CLASSTYPE_LAZY_*/lazily_declare_fn)
> which can happen after the class is complete.
I see, thanks. I have fixed this now by injecting it directly from
lazily_declare_fn, works well. Doing it from grokclassfn instead seems
to be a nuisance because the explicit method attribute might be
processed after the class-propagated attribute is injected, which is the
wrong way around for the desired precedence.
> I think it would work to check for (flags & (ATTR_FLAG_FUNCTION_NEXT |
> ATTR_FLAG_DECL_NEXT)) and return without warning in that case. You'd
> still set *no_add_attr.
Correct, done.
I have added the patch as an attachment, if it garbles it then I will
use git-send-email next time.
That worked fine, thanks.
@@ -1110,6 +1110,28 @@ handle_hot_attribute (tree *node, tree name, tree
ARG_UNUSED (args),
{
/* Attribute hot processing is done later with lookup_attribute. */
}
+ else if ((TREE_CODE (*node) == RECORD_TYPE
+ || TREE_CODE (*node) == UNION_TYPE)
+ && c_dialect_cxx ())
I think you also want to check for ATTR_FLAG_TYPE_IN_PLACE.
@@ -7866,6 +7891,10 @@ finish_struct (tree t, tree attributes)
&& !LAMBDA_TYPE_P (t))
add_stmt (build_min (TAG_DEFN, t));
+ /* This must be done after all lazily declared special member functions
+ have been injected. */
+ propagate_class_warmth_attribute (t);
Maybe call this in check_bases_and_members instead?
Jason