From patchwork Thu Jan 3 12:30:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFA] statement before variable declaration in cp_parser_initializer_list. Date: Thu, 03 Jan 2013 02:30:24 -0000 From: Joel Brobecker X-Patchwork-Id: 209241 Message-Id: <1357216224-513-1-git-send-email-brobecker@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Joel Brobecker Hello, I happened to notice a warning while compiling GCC, and it seemed like an easy fix... gcc/cp/ChangeLog: * parser.c (cp_parser_initializer_list): Move declaration of variable non_const to start of lexical block. Tested against x86_64-linux, no regression. OK to commit? (obvious?) Thanks, diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 3dc2ec6..61d93f8 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17932,9 +17932,10 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p) && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE)) { /* In C++11, [ could start a lambda-introducer. */ + bool non_const = false; + cp_parser_parse_tentatively (parser); cp_lexer_consume_token (parser->lexer); - bool non_const = false; designator = cp_parser_constant_expression (parser, true, &non_const); cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE); cp_parser_require (parser, CPP_EQ, RT_EQ);