[cfe-commits] r103210 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
Douglas Gregor
dgregor at apple.com
Thu May 6 16:31:27 PDT 2010
Author: dgregor
Date: Thu May 6 18:31:27 2010
New Revision: 103210
URL: http://llvm.org/viewvc/llvm-project?rev=103210&view=rev
Log:
It turns out that we should be allowing redeclarations within function
scope. Thanks to Steven Watanabe for correcting me.
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=103210&r1=103209&r2=103210&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu May 6 18:31:27 2010
@@ -3880,8 +3880,9 @@
// 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
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=103210&r1=103209&r2=103210&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 Thu May 6 18:31:27 2010
@@ -81,3 +81,18 @@
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;
+ }
+}
More information about the cfe-commits
mailing list