+2004-01-14 Danny Smith <dannysmith@users,sourceforge.net>
+
+ PR c++/9021
+ PR c++/11005
+ * parser.c (cp_parser_elaborated_type_specifier): Warn about
+ attributes and discard.
+ * decl.c (xref_tag): Don't overwite existing attributes with
+ NULL_TREE.
+
2004-01-14 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/12335
/* Process declarations and variables for C++ compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
redeclare_class_template (t, current_template_parms);
}
- TYPE_ATTRIBUTES (t) = attributes;
+ /* Add attributes only when defining a class. */
+ if (attributes)
+ {
+ /* The only place that xref_tag is called with non-null
+ attributes is in cp_parser_class_head(), when defining a
+ class. */
+ my_friendly_assert (TYPE_ATTRIBUTES (t) == NULL_TREE, 20040113);
+ TYPE_ATTRIBUTES (t) = attributes;
+ }
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
definition of a new type; a new type can only be declared in a
declaration context. */
+ /* Warn about attributes. They are ignored. */
+ if (attributes)
+ warning ("type attributes are honored only at type definition");
+
type = xref_tag (tag_type, identifier,
- attributes,
+ /*attributes=*/NULL_TREE,
(is_friend
|| !is_declaration
|| cp_lexer_next_token_is_not (parser->lexer,