diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2004-01-14 07:27:07 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@gcc.gnu.org> | 2004-01-14 07:27:07 +0000 |
commit | e0fed25b88289fd378dd3613bd6f291fd2c299d8 (patch) | |
tree | 52e76df3fdf4e9747586b44ff6071a6df782028c /gcc | |
parent | 79551a561038fa24ba4cdade1f61529faee366b2 (diff) | |
download | gcc-e0fed25b88289fd378dd3613bd6f291fd2c299d8.zip gcc-e0fed25b88289fd378dd3613bd6f291fd2c299d8.tar.gz gcc-e0fed25b88289fd378dd3613bd6f291fd2c299d8.tar.bz2 |
re PR c++/9021 ([win32] No exports possible when using a class pointer in an union)
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.
From-SVN: r75846
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/decl.c | 12 | ||||
-rw-r--r-- | gcc/cp/parser.c | 6 |
3 files changed, 24 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bd48e17..a538bf8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9a83069..625f94b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1,6 +1,6 @@ /* 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. @@ -9477,7 +9477,15 @@ xref_tag (enum tag_types tag_code, tree name, tree attributes, 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); } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a44ebe4..db89e45 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -9065,8 +9065,12 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, 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, |