[cfe-commits] r120063 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
John McCall
rjmccall at apple.com
Tue Nov 23 14:03:52 PST 2010
Author: rjmccall
Date: Tue Nov 23 16:03:51 2010
New Revision: 120063
URL: http://llvm.org/viewvc/llvm-project?rev=120063&view=rev
Log:
Redeclarations of using declarations are not okay in function scopes.
Not sure what I was thinking before.
Fixes PR8668.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=120063&r1=120062&r2=120063&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Nov 23 16:03:51 2010
@@ -3961,8 +3961,8 @@
// 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
Modified: cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp?rev=120063&r1=120062&r2=120063&view=diff
==============================================================================
--- cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp (original)
+++ cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp Tue Nov 23 16:03:51 2010
@@ -82,7 +82,7 @@
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 @@
}
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;
+ }
}
}
More information about the cfe-commits
mailing list