re PR c++/15787 (Poor error message with if and blocks)
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Sat, 3 Mar 2007 15:32:13 +0000 (15:32 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Sat, 3 Mar 2007 15:32:13 +0000 (15:32 +0000)
commit4606b05cd78922cf9b214471c36ef066f3fa9e50
treea37e403d644d8673beafbffae9500ca26a0f8fd2
parent9f1fd47476f8b7cfb1d14e7409b73b38a892cad3
re PR c++/15787 (Poor error message with if and blocks)

2007-03-03  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

PR c++/15787
* parser.c (struct cp_parser): New IN_IF_STMT.
(cp_parser_statement_seq_opt): Handle an unexpected 'else',
returning if parsing the body of an 'if' statement or issuing an
error and continuing.
(cp_parser_selection_statement): Set IN_IF_STMT bit when parsing
body of 'if'.
(cp_parser_jump_statement): Mask new IN_IF_STMT bit.

testsuite/
* g++.dg/parse/else.C: New.
* g++.dg/parse/else-2.C: New.

From-SVN: r122505
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/else-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/parse/else.C [new file with mode: 0644]