re PR c++/68645 (FAIL: c-c++-common/attr-simd-3.c -std=gnu++11 (test for excess...
authorJason Merrill <jason@redhat.com>
Fri, 4 Dec 2015 18:18:27 +0000 (13:18 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 4 Dec 2015 18:18:27 +0000 (13:18 -0500)
PR c++/68645
* parser.c (cp_parser_direct_declarator)
(cp_parser_late_return_type_opt): Put Cilk+ attributes on
declarator->attributes, not std_attributes.

From-SVN: r231294

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/c-c++-common/attr-simd-3.c

index dd56155b3499662ba5ec30c289724e3b3ebdf251..4568fb8c87a6a505f45e9b422cb1b31a1a84835a 100644 (file)
@@ -1,3 +1,10 @@
+2015-12-04  Jason Merrill  <jason@redhat.com>
+
+       PR c++/68645
+       * parser.c (cp_parser_direct_declarator)
+       (cp_parser_late_return_type_opt): Put Cilk+ attributes on
+       declarator->attributes, not std_attributes.
+
 2015-12-04  David Malcolm  <dmalcolm@redhat.com>
 
        * cp-tree.h (class cp_expr): New class.
index 17dba0d0dc66c97a6a13aa8172eaffe9717d784e..b28d17a9b492c3037d75a48594c6a6f620d98c59 100644 (file)
@@ -18714,6 +18714,7 @@ cp_parser_direct_declarator (cp_parser* parser,
                  /* In here, we handle cases where attribute is used after
                     the function declaration.  For example:
                     void func (int x) __attribute__((vector(..)));  */
+                 tree gnu_attrs = NULL_TREE;
                  if (flag_cilkplus
                      && cp_next_tokens_can_be_gnu_attribute_p (parser))
                    {
@@ -18727,7 +18728,7 @@ cp_parser_direct_declarator (cp_parser* parser,
                      else if (!cp_parser_parse_definitely (parser))
                        ;
                      else
-                       attrs = chainon (attr, attrs);
+                       gnu_attrs = attr;
                    }
                  tree requires_clause = NULL_TREE;
                  late_return = (cp_parser_late_return_type_opt
@@ -18748,6 +18749,7 @@ cp_parser_direct_declarator (cp_parser* parser,
                                                     late_return,
                                                     requires_clause);
                  declarator->std_attributes = attrs;
+                 declarator->attributes = gnu_attrs;
                  /* Any subsequent parameter lists are to do with
                     return type, so are not those of the declared
                     function.  */
@@ -19547,17 +19549,17 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_declarator *declarator,
   requires_clause = cp_parser_requires_clause_opt (parser);
 
   if (cilk_simd_fn_vector_p)
-    declarator->std_attributes
+    declarator->attributes
       = cp_parser_late_parsing_cilk_simd_fn_info (parser,
-                                                 declarator->std_attributes);
+                                                 declarator->attributes);
   if (declare_simd_p)
-    declarator->std_attributes
+    declarator->attributes
       = cp_parser_late_parsing_omp_declare_simd (parser,
-                                                declarator->std_attributes);
+                                                declarator->attributes);
   if (oacc_routine_p)
-    declarator->std_attributes
+    declarator->attributes
       = cp_parser_late_parsing_oacc_routine (parser,
-                                            declarator->std_attributes);
+                                            declarator->attributes);
 
   if (quals >= 0)
     {
index 35dd4c00563e6dc2634eb94c2d1a6574b7eea931..d61ba82de3c73f94d25338f44cc88ebc8f660f01 100644 (file)
@@ -2,4 +2,4 @@
 /* { dg-options "-fcilkplus" } */
 /* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
 
-void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" "PR68158" { xfail c++ } } */
+void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" "PR68158" } */