aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1999-04-13 00:10:42 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-04-12 20:10:42 -0400
commitf2e2cbd4a21cad06f5cb58e533209fa484acc672 (patch)
tree8a25f3b6c9e80c0a5e909a8b53210b24fe44daa8
parent20c395720e1d3731f347086be7b26ea35eb98bb6 (diff)
downloadgcc-f2e2cbd4a21cad06f5cb58e533209fa484acc672.zip
gcc-f2e2cbd4a21cad06f5cb58e533209fa484acc672.tar.gz
gcc-f2e2cbd4a21cad06f5cb58e533209fa484acc672.tar.bz2
decl.c (xref_tag): Only complain once about using a typedef-name with 'struct'.
* 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. From-SVN: r26392
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c27
2 files changed, 18 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a2fe0ce..5531d63 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
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.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c233079..89b1367 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10090,6 +10090,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
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
@@ -12354,9 +12358,17 @@ xref_tag (code_type_node, name, globalize)
{
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
@@ -12481,19 +12493,6 @@ xref_tag (code_type_node, name, globalize)
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;
}