aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaDeclCXX.cpp4
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp15
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 235b41e342..ad8b8695cc 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -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
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
index 466097171c..5ba22c8419 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
@@ -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; // 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::f;
- using N::type;
using N::type;
+ {
+ using N::f;
+ using N::type;
+ }
}
}