]> 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, 28 Apr 2011 20:29:44 +0000 (20:29 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 28 Apr 2011 20:29:44 +0000 (16:29 -0400)
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: r173133

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

index dafef233d77b2593bf0e9830c0b6d2d1dd12b863..3f0c0757806250f29c66171e081e8af2cb4d6ac7 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.
+
 2011-03-08  Jason Merrill  <jason@redhat.com>
 
        PR c++/45651
index d13cf379a558220fb8e00b068439f788847103ce..5fc93f5f87f12c2c381280fcf976332d8669693e 100644 (file)
@@ -11437,6 +11437,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 b3f0d169331e635cc66b788a32e9ad0b1cd1ed0e..bc670dc75ec18bd6b375a1eecec32125443d5556 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.
+
 2011-03-08  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/template/anon5.C: New.
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;
+}