@@ -14423,6 +14423,25 @@ cp_parser_declaration (cp_parser* parser
{
location_t attrs_loc = token1->location;
tree std_attrs = cp_parser_std_attribute_spec_seq (parser);
+
+ if (std_attrs && (flag_openmp || flag_openmp_simd))
+ {
+ gcc_assert (!parser->lexer->in_omp_attribute_pragma);
+ std_attrs = cp_parser_handle_statement_omp_attributes (parser,
+ std_attrs);
+ if (parser->lexer->in_omp_attribute_pragma)
+ {
+ cp_lexer *lexer = parser->lexer;
+ while (parser->lexer->in_omp_attribute_pragma)
+ {
+ gcc_assert (cp_lexer_next_token_is (parser->lexer,
+ CPP_PRAGMA));
+ cp_parser_pragma (parser, pragma_external, NULL);
+ }
+ cp_lexer_destroy (lexer);
+ }
+ }
+
if (std_attrs != NULL_TREE)
warning_at (make_location (attrs_loc, attrs_loc, parser->lexer),
OPT_Wattributes, "attribute ignored");
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++11 } }
+
+[[omp::sequence (directive (requires, atomic_default_mem_order (seq_cst)))]];
+[[omp::directive (declare reduction (plus: int: omp_out += omp_in) initializer (omp_priv = 0))]];
+int a;
+[[omp::directive (declare target (a))]];
+int t;
+[[omp::sequence (omp::directive (threadprivate (t)))]];
+int b, c;
+[[omp::directive (declare target, to (b), link (c))]];
+[[omp::directive (declare target)]];
+[[omp::directive (declare target)]];
+int d;
+[[omp::directive (end declare target)]];
+[[omp::directive (end declare target)]];