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:
Douglas Gregor 2010-05-06 23:31:27 +00:00
parent d8bb3aff76
commit 4b718ee691
2 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -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;
}
}