From: Danny Smith Date: Wed, 14 Jan 2004 07:27:07 +0000 (+0000) Subject: re PR c++/9021 ([win32] No exports possible when using a class pointer in an union) X-Git-Tag: releases/gcc-3.4.0~997 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0fed25b88289fd378dd3613bd6f291fd2c299d8;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bd48e17c37f8..a538bf80ad86 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2004-01-14 Danny Smith + + 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 PR c++/12335 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9a830698bb6f..625f94b7048a 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 a44ebe49e5f6..db89e4520f98 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,