1999-04-12 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (xref_tag): Only complain once about using a typedef-name
+ with 'struct'. Downgrade to pedwarn.
+
+ * decl.c (grokdeclarator): Allow [] syntax for zero-length array.
+
* parse.y (absdcl_intern): New nonterminal.
(absdcl, direct_abstract_declarator): Use it.
if (type == error_mark_node)
continue;
+ /* VC++ spells a zero-sized array with []. */
+ if (size == NULL_TREE && decl_context == FIELD && ! staticp)
+ size = integer_zero_node;
+
if (size)
{
/* Must suspend_momentary here because the index
{
if (t)
{
- if (t != TYPE_MAIN_VARIANT (t))
+ /* [dcl.type.elab] If the identifier resolves to a
+ typedef-name or a template type-parameter, the
+ elaborated-type-specifier is ill-formed. */
+ if (t != TYPE_MAIN_VARIANT (t)
+ || (CLASS_TYPE_P (t) && TYPE_WAS_ANONYMOUS (t)))
cp_pedwarn ("using typedef-name `%D' after `%s'",
TYPE_NAME (t), tag_name (tag_code));
+ else if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
+ cp_error ("using template type parameter `%T' after `%s'",
+ t, tag_name (tag_code));
+
ref = t;
}
else
TREE_TYPE (ref) = attributes;
- if (ref && TYPE_P (ref))
- {
- /* [dcl.type.elab]
-
- If the identifier resolves to a typedef-name or a template
- type-parameter, the elaborated-type-specifier is
- ill-formed. */
- if (TYPE_LANG_SPECIFIC (ref) && TYPE_WAS_ANONYMOUS (ref))
- cp_error ("`%T' is a typedef name", ref);
- else if (TREE_CODE (ref) == TEMPLATE_TYPE_PARM)
- cp_error ("`%T' is a template type paramter", ref);
- }
-
return ref;
}