summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-13 00:10:42 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-13 00:10:42 +0000
commitbed88d29cfb7e37fae8434520255e51d669d6aa4 (patch)
tree8a25f3b6c9e80c0a5e909a8b53210b24fe44daa8
parentc961c636ed07793f4eb89ef964e6c2e6b23e9361 (diff)
downloadppe42-gcc-bed88d29cfb7e37fae8434520255e51d669d6aa4.tar.gz
ppe42-gcc-bed88d29cfb7e37fae8434520255e51d669d6aa4.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26392 138bc75d-0d04-0410-961f-82ee72b054a4
-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 a2fe0ce43e3..5531d63f4ac 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 c233079e9b5..89b136793bf 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;
}
OpenPOWER on IntegriCloud