forked from OSchip/llvm-project
It turns out that we should be allowing redeclarations within function
scope. Thanks to Steven Watanabe for correcting me. llvm-svn: 103210
This commit is contained in:
parent
d8bb3aff76
commit
4b718ee691
|
@ -3880,8 +3880,9 @@ bool Sema::CheckUsingDeclRedeclaration(SourceLocation UsingLoc,
|
|||
// A using-declaration is a declaration and can therefore be used
|
||||
// repeatedly where (and only where) multiple declarations are
|
||||
// allowed.
|
||||
// That's only in file contexts.
|
||||
if (CurContext->getLookupContext()->isFileContext())
|
||||
//
|
||||
// That's in non-member contexts.
|
||||
if (!CurContext->getLookupContext()->isRecord())
|
||||
return false;
|
||||
|
||||
NestedNameSpecifier *Qual
|
||||
|
|
|
@ -81,3 +81,18 @@ namespace test2 {
|
|||
|
||||
template struct Derived<int>; // expected-note {{in instantiation of template class}}
|
||||
}
|
||||
|
||||
// Redeclarations are okay in a function.
|
||||
namespace test3 {
|
||||
namespace N {
|
||||
int f(int);
|
||||
typedef int type;
|
||||
}
|
||||
|
||||
void g() {
|
||||
using N::f;
|
||||
using N::f;
|
||||
using N::type;
|
||||
using N::type;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue