]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/39219 (attribute doesn't work with enums properly)
authorH.J. Lu <hongjiu.lu@intel.com>
Thu, 19 Feb 2009 01:58:15 +0000 (01:58 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Thu, 19 Feb 2009 01:58:15 +0000 (17:58 -0800)
gcc/cp

2009-02-18  H.J. Lu  <hongjiu.lu@intel.com>

PR c++/39219
* parser.c (cp_parser_enum_specifier): Apply all attributes.

gcc/testsuite/

2009-02-18  H.J. Lu  <hongjiu.lu@intel.com>

PR c++/39219
* g++.dg/parse/attr3.C: New.

From-SVN: r144284

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/attr3.C [new file with mode: 0644]

index 3ca03d37a3afe61e714004954255637786133e01..709453d91ff90b3d6b345767adcafc312587cbd0 100644 (file)
@@ -1,3 +1,8 @@
+2009-02-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR c++/39219
+       * parser.c (cp_parser_enum_specifier): Apply all attributes.
+
 2009-02-18  Jason Merrill  <jason@redhat.com>
 
        * cfns.h: Tweak pathname for cfns.gperf.
index 404e45a14c62d03deca408519033e263be7d7365..ead7d3a3907d3a02397bb5b75f7ba95955f5ca6e 100644 (file)
@@ -11916,6 +11916,7 @@ cp_parser_enum_specifier (cp_parser* parser)
   if (cp_parser_allow_gnu_extensions_p (parser))
     {
       tree trailing_attr = cp_parser_attributes_opt (parser);
+      trailing_attr = chainon (trailing_attr, attributes);
       cplus_decl_attributes (&type,
                             trailing_attr,
                             (int) ATTR_FLAG_TYPE_IN_PLACE);
index 0605ccbe0cedc3c7d2d331acbb784e611aea31b9..bd0c95cc6ba0fe1049a5a792ef262f55095b3359 100644 (file)
@@ -1,3 +1,8 @@
+2009-02-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR c++/39219
+       * g++.dg/parse/attr3.C: New.
+
 2009-02-18  Jack Howarth <howarth@bromo.med.uc.edu>
 
        PR testsuite/38165
diff --git a/gcc/testsuite/g++.dg/parse/attr3.C b/gcc/testsuite/g++.dg/parse/attr3.C
new file mode 100644 (file)
index 0000000..848df05
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/39219
+
+enum __attribute__ ((deprecated)) E { e };
+struct S { enum __attribute__ ((deprecated)) F { f = e }; };
+
+int main () {
+    E x;       // { dg-warning "'E' is deprecated" "" }
+    x = e;
+
+    S::F y;    // { dg-warning "'F' is deprecated" "" }
+    y = S::f;
+
+    return x + y;
+}