From 0806181f233acd921de0881a65423eafc7cf8a5e Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 15 Aug 2018 08:20:21 +0000 Subject: [PATCH] decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2 emit an error instead of a permerror. /cp 2018-08-15 Paolo Carlini * 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 * g++.dg/init/goto3.C: Adjust for error instead of permerror. From-SVN: r263551 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 3 ++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/init/goto3.C | 6 +++--- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 40b384a1e62..8e123713873 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-08-15 Paolo Carlini + + * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2 + emit an error instead of a permerror. + 2018-08-13 Marek Polacek PR c++/57891 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9a2e3247946..fa58bc4d2b3 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b8d76d0dde6..18cae4dc6f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-08-15 Paolo Carlini + + * g++.dg/init/goto3.C: Adjust for error instead of permerror. + 2018-08-14 Allan Sandfeld Jensen * gcc.target/i386/sse2-movs.c: New test. diff --git a/gcc/testsuite/g++.dg/init/goto3.C b/gcc/testsuite/g++.dg/init/goto3.C index 4c5ceaba3e1..72ca9b9d75c 100644 --- a/gcc/testsuite/g++.dg/init/goto3.C +++ b/gcc/testsuite/g++.dg/init/goto3.C @@ -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" } } } -- 2.30.2