forked from OSchip/llvm-project
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:
parent
f77daf5e58
commit
2460b0c941
|
@ -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()) {
|
||||
|
|
|
@ -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}}
|
||||
|
Loading…
Reference in New Issue