Fix the scope of K&R-style argument declarations so that they don't

extend beyond the end of the function.

I'm not completely sure this is the right way to fix this bug, so 
someone familiar with the parser should double-check.

llvm-svn: 51311
This commit is contained in:
Eli Friedman 2008-05-20 09:10:20 +00:00
parent f77daf5e58
commit 2460b0c941
2 changed files with 6 additions and 1 deletions

View File

@ -511,7 +511,7 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) {
// Enter function-declaration scope, limiting any declarators to the
// function prototype scope, including parameter declarators.
EnterScope(Scope::DeclScope);
EnterScope(Scope::FnScope|Scope::DeclScope);
// Read all the argument declarations.
while (isDeclarationSpecifier()) {

View File

@ -0,0 +1,5 @@
// RUN: clang -fsyntax-only %s -verify
x(a) int a; {return a;}
y(b) int b; {return a;} // expected-error {{use of undeclared identifier}}