diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-06 23:31:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-06 23:31:27 +0000 |
commit | 4b718ee691f0f168021286f7ee75f52224cb8a1c (patch) | |
tree | d02eabe063d6924b5e861e7065480d9fa514ce81 | |
parent | d8bb3aff76145e391a0df4be7591021d083bc258 (diff) | |
download | bcm5719-llvm-4b718ee691f0f168021286f7ee75f52224cb8a1c.tar.gz bcm5719-llvm-4b718ee691f0f168021286f7ee75f52224cb8a1c.zip |
It turns out that we should be allowing redeclarations within function
scope. Thanks to Steven Watanabe for correcting me.
llvm-svn: 103210
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 5 | ||||
-rw-r--r-- | clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 23b3601f09a..e32a308af58 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -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 diff --git a/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp b/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp index fd2df010fc9..466097171c8 100644 --- a/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp +++ b/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp @@ -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; + } +} |