From 3825c2eb00f108854942533a4993327889c081c3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 6 Apr 2008 06:50:56 +0000 Subject: [PATCH] reject 'int test(x, x) int x; {}' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49271 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseDecl.cpp | 1 + test/Parser/declarators.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index cae0cbb8ec..0cf97d22de 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1400,6 +1400,7 @@ void Parser::ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc, // Tok is known to be the first identifier in the list. Remember this // identifier in ParamInfo. + ParamsSoFar.insert(Tok.getIdentifierInfo()); ParamInfo.push_back(DeclaratorChunk::ParamInfo(Tok.getIdentifierInfo(), Tok.getLocation(), 0)); diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c index 410ac3686f..3e0380ea87 100644 --- a/test/Parser/declarators.c +++ b/test/Parser/declarators.c @@ -30,3 +30,5 @@ int test3(x, atype /* expected-error {{unexpected type name 'atype': expected identifier}} */ ) int x, atype; {} +int test4(x, x) int x; {} /* expected-error {{redefinition of parameter 'x'}} */ + -- 2.40.0