Handle redeclarations of catch variables in catch blocks.
Fix to regression caused by r167650, caught by Richard Smith in code review. llvm-svn: 167653
This commit is contained in:
parent
9268c94b15
commit
43df4cc568
|
@ -138,8 +138,11 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
|
|||
if (S->getFlags() & Scope::FnTryScope)
|
||||
return S->getParent()->isDeclScope(D);
|
||||
if (S->getParent()->getFlags() & Scope::ControlScope) {
|
||||
if (S->getParent()->getFlags() & Scope::FnCatchScope)
|
||||
if (S->getParent()->getFlags() & Scope::FnCatchScope) {
|
||||
S = S->getParent();
|
||||
if (S->isDeclScope(D))
|
||||
return true;
|
||||
}
|
||||
return S->getParent()->isDeclScope(D);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,3 +23,15 @@ void func5() try {
|
|||
} catch (...) {
|
||||
int j = i; // expected-error{{use of undeclared identifier 'i'}}
|
||||
}
|
||||
|
||||
void func6() try {
|
||||
} catch (int i) { // expected-note{{previous definition is here}}
|
||||
int i; // expected-error{{redefinition of 'i'}}
|
||||
}
|
||||
|
||||
void func7() {
|
||||
try {
|
||||
} catch (int i) { // expected-note{{previous definition is here}}
|
||||
int i; // expected-error{{redefinition of 'i'}}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue