summaryrefslogtreecommitdiff
path: root/gcc/c-parser.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-18 00:38:28 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-18 00:38:28 +0000
commit22d77a940fe1fd9bc220e98d2d6ba3734816e3c0 (patch)
treeb808756b4789718dbb49b44aabd79d616d50a129 /gcc/c-parser.c
parentf1d3f265ad1560fb80f86de41b8fee44cbc8fdc4 (diff)
downloadgcc-22d77a940fe1fd9bc220e98d2d6ba3734816e3c0.tar.gz
PR c/35447
* c-parser.c (c_parser_compound_statement): Always enter and leave a scope. testsuite: * gcc.dg/noncompile/pr35447-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144256 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r--gcc/c-parser.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 9aef031a8eb..6dfcb601597 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -3307,7 +3307,13 @@ c_parser_compound_statement (c_parser *parser)
{
tree stmt;
if (!c_parser_require (parser, CPP_OPEN_BRACE, "expected %<{%>"))
- return error_mark_node;
+ {
+ /* Ensure a scope is entered and left anyway to avoid confusion
+ if we have just prepared to enter a function body. */
+ stmt = c_begin_compound_stmt (true);
+ c_end_compound_stmt (stmt, true);
+ return error_mark_node;
+ }
stmt = c_begin_compound_stmt (true);
c_parser_compound_statement_nostart (parser);
return c_end_compound_stmt (stmt, true);