------- Comment #12 from jason at redhat dot com  2008-04-04 18:10 -------
Subject: Re:  [4.3/4.4 Regression] vector_size attribute lost
 in function arguments for templates

jakub at gcc dot gnu dot org wrote:
> Actually, to clarify #c10, attributes on parameter packs just make things
> harder on the compiler side, but even in C++98 the same issue is present:
> #define vector __attribute__((__vector_size__ (16)))
> 
> template <typename T> void foo (int x, vector T y) { }
> void bar (vector long a, vector double b)
> {
>   foo<long> (5, a);
>   foo (5, b);
> }

This functionality seems desirable, but cannot be considered a regression.

> Are there any attributes other than vector_size which affect the decls
> similarly?

I don't think so.

> If not, I'd say that the C++ FE should hardcode some knowledge about this
> attribute, e.g. know that it applies to the type, so if
> processing_template_decl
> move them from DECL_ATTRIBUTES to corresponding type's TYPE_ATTRIBUTES (either
> the parameter type such that it would be in TYPE_ARG_TYPES too, or for
> FUNCTION_TYPE/METHOD_TYPE stick it into return type's TYPE_ATTRIBUTES).
> And in type_unification_real take it into account.

This makes sense to me.  Though I think that if we just push the 
attribute down to the type that it actually modifies, we don't have to 
think about TYPE_ARG_TYPES.  That should also avoid the need for 
reconstruct_complex_type.

Jason


-- 


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

Reply via email to