decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2 emit an error instead...
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 15 Aug 2018 08:20:21 +0000 (08:20 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 15 Aug 2018 08:20:21 +0000 (08:20 +0000)
/cp
2018-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

* decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
emit an error instead of a permerror.

/testsuite
2018-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.dg/init/goto3.C: Adjust for error instead of permerror.

From-SVN: r263551

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/goto3.C

index 40b384a1e6202cf48838db47f87b5cf9e53a4014..8e12371387365274e336abacc73e78366cf0c562 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
+       emit an error instead of a permerror.
+
 2018-08-13  Marek Polacek  <polacek@redhat.com>
 
        PR c++/57891
index 9a2e3247946667d23d51383ff225318b048e5928..fa58bc4d2b3ee69254e4d4c367dc16eccab64bed 100644 (file)
@@ -3191,7 +3191,8 @@ check_previous_goto_1 (tree decl, cp_binding_level* level, tree names,
          if (!identified)
            {
              complained = identify_goto (decl, input_location, locus,
-                                         DK_PERMERROR);
+                                         problem > 1
+                                         ? DK_ERROR : DK_PERMERROR);
              identified = 1;
            }
          if (complained)
index b8d76d0dde64d563573b26e35d1474becda71a27..18cae4dc6f834a4a40b6b8bd2b26acfa7e6abdac 100644 (file)
@@ -1,3 +1,7 @@
+2018-08-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * g++.dg/init/goto3.C: Adjust for error instead of permerror.
+
 2018-08-14 Allan Sandfeld Jensen <allan.jensen@qt.io>
 
        * gcc.target/i386/sse2-movs.c: New test.
index 4c5ceaba3e1fdb7b430be7b639cd554da474b39a..72ca9b9d75cb485404609ea8624027c6ca44aa7f 100644 (file)
@@ -15,11 +15,11 @@ adapt_parameters_next_iteration(void)
     case VAR_NONE: break;
 
     case VAR_DELTA:
-        int trunc_n_ants = 0;
+        int trunc_n_ants = 0;  // { dg-message "initialization" }
         n_ants += trunc_n_ants;
         break;
-    case VAR_SWITCH:
+    case VAR_SWITCH:  // { dg-error "jump" }
         break;
-      default: break;
+      default: break;  // { dg-error "jump" }
     }
 }