------- Comment #11 from jakub at gcc dot gnu dot org  2008-04-03 11:28 -------
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);
}

If we apply late template attributes in fn_type_unification, then the foo<long>
(5, a); call will work as expected, but should the second call deduce template
parameter double or vector double?  If the latter (which would be weird), then
it will fail, because vector_size attribute can't be applied to a VECTOR_TYPE.

Are there any attributes other than vector_size which affect the decls
similarly?
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.


-- 


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

Reply via email to