]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
openmp: Fix up cp/parser.c build with GCC 4.8 to 6
authorJakub Jelinek <jakub@redhat.com>
Tue, 10 Aug 2021 16:30:27 +0000 (18:30 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Tue, 10 Aug 2021 16:30:35 +0000 (18:30 +0200)
Christophe Lyon reported that cp/parser.c no longer compiles with
GCC 4.8.5 after my recent OpenMP changes.
A goto out; there crosses odsd variable declaration, and odsd has
a vec<...> member where vec has = default; default constructor
and gcc before r7-2822-gd0b0fbd9fce2f30a82558bf2308b3a7b56c2f364
treated that as error.

Fixed by moving the declaration earlier before the goto.

Tested on x86_64-linux with GCC 4.8.5 system gcc, committed to trunk
as obvious.

2021-08-10  Jakub Jelinek  <jakub@redhat.com>

* parser.c (cp_parser_member_declaration): Move odsd declaration
before cp_parser_using_declaration call to avoid errors with
GCC 4.8 to 6.

(cherry picked from commit d796cc7a3e719cc36f1851ca322e2877b974691b)

gcc/cp/ChangeLog.omp
gcc/cp/parser.c

index b457f5d901e06e475b7d308a9ba6619d6d90c46a..dbc0245c4d3f8c277ad598167a15a64cc9a94ab2 100644 (file)
@@ -1,3 +1,12 @@
+2021-08-10  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-08-10  Jakub Jelinek  <jakub@redhat.com>
+
+       * parser.c (cp_parser_member_declaration): Move odsd declaration
+       before cp_parser_using_declaration call to avoid errors with
+       GCC 4.8 to 6.
+
 2021-08-10  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index 5a7a4c98390ef3341b524aa7a1f217442ee64848..824c8288f405a0aa7a8dbcc98a0c4c0a8f654c53 100644 (file)
@@ -26500,8 +26500,9 @@ cp_parser_member_declaration (cp_parser* parser)
 
   parser->colon_corrects_to_scope_p = false;
 
+  cp_omp_declare_simd_data odsd;
   if (cp_parser_using_declaration (parser, /*access_declaration=*/true))
-      goto out;
+    goto out;
 
   /* Parse the decl-specifier-seq.  */
   decl_spec_token_start = cp_lexer_peek_token (parser->lexer);
@@ -26511,7 +26512,6 @@ cp_parser_member_declaration (cp_parser* parser)
                                &decl_specifiers,
                                &declares_class_or_enum);
 
-  cp_omp_declare_simd_data odsd;
   if (decl_specifiers.attributes && (flag_openmp || flag_openmp_simd))
     cp_parser_handle_directive_omp_attributes (parser,
                                               &decl_specifiers.attributes,