]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/9021 ([win32] No exports possible when using a class pointer in an union)
authorDanny Smith <dannysmith@users.sourceforge.net>
Wed, 14 Jan 2004 07:27:07 +0000 (07:27 +0000)
committerDanny Smith <dannysmith@gcc.gnu.org>
Wed, 14 Jan 2004 07:27:07 +0000 (07:27 +0000)
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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/parser.c

index bd48e17c37f84df73254196cf8f96ad5ace7c7c3..a538bf80ad862a2c14ba5379addac8c8d6475219 100644 (file)
@@ -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
index 9a830698bb6f3d24c475600423eae653d5538b4e..625f94b7048ad8a887ebd08f59e9de00c9e685e2 100644 (file)
@@ -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);
 }
index a44ebe49e5f634af90b85e33f26a57aa04931f18..db89e4520f98268989069949169b38c4217f2b82 100644 (file)
@@ -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,