Commit 160b8b80 by Jason Merrill Committed by Jason Merrill

re PR c++/34913 (ICE vector in template)

        PR c++/34913
        * decl2.c (is_late_template_attribute): Defer any attribute with
        dependent args.  Also defer type attributes if the type is dependent.

From-SVN: r131779
parent 89bf8683
2008-01-24 Jason Merrill <jason@redhat.com>
PR c++/34913
* decl2.c (is_late_template_attribute): Defer any attribute with
dependent args. Also defer type attributes if the type is dependent.
2008-01-22 Jakub Jelinek <jakub@redhat.com>, Alexandre Oliva <aoliva@redhat.com> 2008-01-22 Jakub Jelinek <jakub@redhat.com>, Alexandre Oliva <aoliva@redhat.com>
PR c++/33984 PR c++/33984
......
...@@ -985,17 +985,25 @@ is_late_template_attribute (tree attr, tree decl) ...@@ -985,17 +985,25 @@ is_late_template_attribute (tree attr, tree decl)
tree name = TREE_PURPOSE (attr); tree name = TREE_PURPOSE (attr);
tree args = TREE_VALUE (attr); tree args = TREE_VALUE (attr);
const struct attribute_spec *spec = lookup_attribute_spec (name); const struct attribute_spec *spec = lookup_attribute_spec (name);
tree arg;
if (!spec) if (!spec)
/* Unknown attribute. */ /* Unknown attribute. */
return false; return false;
if (is_attribute_p ("aligned", name) /* If any of the arguments are dependent expressions, we can't evaluate
&& args the attribute until instantiation time. */
&& value_dependent_expression_p (TREE_VALUE (args))) for (arg = args; arg; arg = TREE_CHAIN (arg))
/* Can't apply this until we know the desired alignment. */ {
tree t = TREE_VALUE (arg);
if (value_dependent_expression_p (t)
|| type_dependent_expression_p (t))
return true; return true;
else if (TREE_CODE (decl) == TYPE_DECL || spec->type_required) }
if (TREE_CODE (decl) == TYPE_DECL
|| TYPE_P (decl)
|| spec->type_required)
{ {
tree type = TYPE_P (decl) ? decl : TREE_TYPE (decl); tree type = TYPE_P (decl) ? decl : TREE_TYPE (decl);
...@@ -1006,6 +1014,10 @@ is_late_template_attribute (tree attr, tree decl) ...@@ -1006,6 +1014,10 @@ is_late_template_attribute (tree attr, tree decl)
|| code == BOUND_TEMPLATE_TEMPLATE_PARM || code == BOUND_TEMPLATE_TEMPLATE_PARM
|| code == TYPENAME_TYPE) || code == TYPENAME_TYPE)
return true; return true;
/* Also defer attributes on dependent types. This is not necessary
in all cases, but is the better default. */
else if (dependent_type_p (type))
return true;
else else
return false; return false;
} }
......
// PR c++/34913
template<typename T> struct A
{
int x[sizeof(T)] __attribute((vector_size(8)));
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment