mirror of https://github.com/microsoft/clang.git
Revert "Sema: An extern declaration can't be a redeclaration of a parameter"
This reverts commit r225780, we can't compile line 181 in sanitizer_platform_limits_posix.cc with this commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225781 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
940569b471
commit
29b6ec9d09
|
@ -3282,12 +3282,14 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
|
|||
}
|
||||
|
||||
// Check if extern is followed by non-extern and vice-versa.
|
||||
if (New->hasGlobalStorage() && !Old->hasLinkage() && Old->hasLocalStorage()) {
|
||||
if (New->hasExternalStorage() &&
|
||||
!Old->hasLinkage() && Old->isLocalVarDecl()) {
|
||||
Diag(New->getLocation(), diag::err_extern_non_extern) << New->getDeclName();
|
||||
Diag(OldLocation, PrevDiag);
|
||||
return New->setInvalidDecl();
|
||||
}
|
||||
if (Old->hasGlobalStorage() && !New->hasLinkage() && New->hasLocalStorage()) {
|
||||
if (Old->hasLinkage() && New->isLocalVarDecl() &&
|
||||
!New->hasExternalStorage()) {
|
||||
Diag(New->getLocation(), diag::err_non_extern_extern) << New->getDeclName();
|
||||
Diag(OldLocation, PrevDiag);
|
||||
return New->setInvalidDecl();
|
||||
|
|
|
@ -83,7 +83,3 @@ __private_extern__ int g19;
|
|||
int g19 = 0;
|
||||
|
||||
__private_extern__ int g20 = 0;
|
||||
|
||||
void f10(int g20) { // expected-note{{previous definition is here}}
|
||||
extern int g20; // expected-error{{extern declaration of 'g20' follows non-extern declaration}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue