diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-12-21 07:41:49 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-12-21 07:41:49 +0000 |
commit | 6fb0729241ab204e9bed9a5ff2f5bd396db111d4 (patch) | |
tree | e116bed83a112cc0dd55e0ecacbda4d311ccedfe | |
parent | 14af91a38c8cf89f0a5e1835d7d8e0fa220e17a9 (diff) |
When checking a using declaration, make sure that the context we're
looking in is complete. Fixes PR8756.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122323 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/using-decl-1.cpp | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index d257531565..0021c79823 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -4052,6 +4052,10 @@ bool Sema::CheckUsingDeclQualifier(SourceLocation UsingLoc, return true; } + if (!NamedContext->isDependentContext() && + RequireCompleteDeclContext(const_cast<CXXScopeSpec&>(SS), NamedContext)) + return true; + if (getLangOptions().CPlusPlus0x) { // C++0x [namespace.udecl]p3: // In a using-declaration used as a member-declaration, the diff --git a/test/SemaCXX/using-decl-1.cpp b/test/SemaCXX/using-decl-1.cpp index 65be0bc3aa..ebe97f6cca 100644 --- a/test/SemaCXX/using-decl-1.cpp +++ b/test/SemaCXX/using-decl-1.cpp @@ -108,3 +108,13 @@ namespace test2 { template <typename T> using A::f<T>; // expected-error {{cannot template a using declaration}} }; } + +// PR8756 +namespace foo +{ + class Class1; // expected-note{{forward declaration}} + class Class2 + { + using ::foo::Class1::Function; // expected-error{{incomplete type 'foo::Class1' named in nested name specifier}} + }; +} |