Redeclarations of using declarations are not okay in function scopes.

Not sure what I was thinking before.

Fixes PR8668.

llvm-svn: 120063
This commit is contained in:
John McCall 2010-11-23 22:03:51 +00:00
parent f77e11ba05
commit 8a1013f8c3
2 changed files with 14 additions and 5 deletions

View File

@ -3961,8 +3961,8 @@ bool Sema::CheckUsingDeclRedeclaration(SourceLocation UsingLoc,
// repeatedly where (and only where) multiple declarations are
// allowed.
//
// That's in non-member contexts.
if (!CurContext->getRedeclContext()->isRecord())
// That's in file contexts.
if (CurContext->isFileContext())
return false;
NestedNameSpecifier *Qual

View File

@ -82,7 +82,7 @@ namespace test2 {
template struct Derived<int>; // expected-note {{in instantiation of template class}}
}
// Redeclarations are okay in a function.
// PR8668: redeclarations are not okay in a function.
namespace test3 {
namespace N {
int f(int);
@ -90,9 +90,18 @@ namespace test3 {
}
void g() {
using N::f;
using N::f; // expected-note {{previous using declaration}}
using N::f; // expected-error {{redeclaration of using decl}}
using N::type; // expected-note {{previous using declaration}}
using N::type; // expected-error {{redeclaration of using decl}}
}
void h() {
using N::f;
using N::type;
using N::type;
{
using N::f;
using N::type;
}
}
}