[cfe-commits] r122323 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/using-decl-1.cpp
Douglas Gregor
dgregor at apple.com
Mon Dec 20 23:41:49 PST 2010
Author: dgregor
Date: Tue Dec 21 01:41:49 2010
New Revision: 122323
URL: http://llvm.org/viewvc/llvm-project?rev=122323&view=rev
Log:
When checking a using declaration, make sure that the context we're
looking in is complete. Fixes PR8756.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/using-decl-1.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=122323&r1=122322&r2=122323&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Dec 21 01:41:49 2010
@@ -4052,6 +4052,10 @@
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
Modified: cfe/trunk/test/SemaCXX/using-decl-1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/using-decl-1.cpp?rev=122323&r1=122322&r2=122323&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/using-decl-1.cpp (original)
+++ cfe/trunk/test/SemaCXX/using-decl-1.cpp Tue Dec 21 01:41:49 2010
@@ -108,3 +108,13 @@
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}}
+ };
+}
More information about the cfe-commits
mailing list