summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Parse/Parser.cpp2
-rw-r--r--clang/test/Parser/traditional_arg_scope.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 7e41bcc92e3..936604e870b 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -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()) {
diff --git a/clang/test/Parser/traditional_arg_scope.c b/clang/test/Parser/traditional_arg_scope.c
new file mode 100644
index 00000000000..222de863fba
--- /dev/null
+++ b/clang/test/Parser/traditional_arg_scope.c
@@ -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}}
+
OpenPOWER on IntegriCloud