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

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 16 20:04:00 GMT 2013


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

--- Comment #29 from Jason Merrill <jason at gcc dot gnu.org> 2013-01-16 20:03:42 UTC ---
(In reply to comment #25)
> Anyway, with target("any") attribute, what would happen for
> void foo () __attribute__((target ("avx")));
> void foo () __attribute__((target ("any")));
> void foo () {}
> Is the definition "any", something else?

The definition is an error, because it's ambiguous which version it's defining.

(In reply to comment #28)
> Further, if we have these three declarations in this order:
> 
> void foo () __attribute__((target ("avx")));
> void foo () __attribute__((target ("sse4.2")));
> void foo () __attribute__((target ("any")));
> 
> This seems to mean that we want foo to be multi-versioned. However, when the
> front-end is processing the second declaration, how would it decide between
> merging or not without seeing the third?

It would always declare a separate version.  4.7 doesn't actually merge target
attributes, a later declaration just replaces the earlier target attribute;
this seems like useless behavior to me that could be replaced with
multiversioning semantics.



More information about the Gcc-bugs mailing list