[Bug c++/55742] __attribute__ in class function declaration cause "prototype does not match" errors.

tmsriram at google dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 20 18:21:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55742

--- Comment #3 from Sriraman Tallam <tmsriram at google dot com> 2012-12-20 18:21:26 UTC ---
(In reply to comment #2)
> After thinking about this more, I think the problem here is that the attributes
> specified in the declaration of the function are not being used in the function
> definition.
> 
> Jason, shouldn't the attributes specified in the function declaration be
> sufficient?  Or does the user really need to apply attributes to both the
> declaration and the definition?

This can be done during decl merging, by adding the DECL_TARGET_SPECIFIC tree
of the declaration decl to the definition decl.

However, with function multiversioning, this will become a problem as
multiversioning does not treat two decls with different target attributes as
identical. Since we are enabling multiversioning by default, atleast in C++
front-end for now, IMO, it is better to insist that the definition and
declaration contain identical target attributes.


> 
> 
> Thanks.



More information about the Gcc-bugs mailing list