summaryrefslogtreecommitdiffstats
path: root/lib/Sema
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-01-14 00:31:13 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-01-14 00:31:13 +0000
commit3806cf84dce82865ff786f837280441bdb59ead0 (patch)
tree114d9bc6afd9bc0aa5f84f84109c9b74f75cc9dd /lib/Sema
parent5fe8dcb8d847c5a512fd3861942dac38317aa4d4 (diff)
Sema: An extern declaration can't be a redeclaration of a parameter
In the following: void f(int x) { extern int x; } The second declaration of 'x' shouldn't be considered a redeclaration of the parameter. This is a different approach to r225780. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaDecl.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 7d1e28ee59..1bf57f6cee 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3285,12 +3285,12 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
// Check if extern is followed by non-extern and vice-versa.
if (New->hasExternalStorage() &&
- !Old->hasLinkage() && Old->isLocalVarDecl()) {
+ !Old->hasLinkage() && Old->isLocalVarDeclOrParm()) {
Diag(New->getLocation(), diag::err_extern_non_extern) << New->getDeclName();
Diag(OldLocation, PrevDiag);
return New->setInvalidDecl();
}
- if (Old->hasLinkage() && New->isLocalVarDecl() &&
+ if (Old->hasLinkage() && New->isLocalVarDeclOrParm() &&
!New->hasExternalStorage()) {
Diag(New->getLocation(), diag::err_non_extern_extern) << New->getDeclName();
Diag(OldLocation, PrevDiag);