When determining whether a scope specifier is complete, consider a

dependent DeclContext to be "complete". Fixes PR6236.

llvm-svn: 95359
This commit is contained in:
Douglas Gregor 2010-02-05 04:39:02 +00:00
parent c7b9f950d7
commit 8a6d15d5ed
2 changed files with 16 additions and 0 deletions

View File

@ -241,6 +241,10 @@ bool Sema::RequireCompleteDeclContext(const CXXScopeSpec &SS) {
DeclContext *DC = computeDeclContext(SS, true);
if (TagDecl *Tag = dyn_cast<TagDecl>(DC)) {
// If this is a dependent type, then we consider it complete.
if (Tag->isDependentContext())
return false;
// If we're currently defining this type, then lookup into the
// type is okay: don't complain that it isn't complete yet.
const TagType *TagT = Context.getTypeDeclType(Tag)->getAs<TagType>();

View File

@ -68,3 +68,15 @@ struct X0 {
void f2(typename X0<T>::Inner<T*, T&>::type); // expected-note{{here}}
void f2(typename X0<T>::template Inner<T*, T&>::type); // expected-error{{redecl}}
};
namespace PR6236 {
template<typename T, typename U> struct S { };
template<typename T> struct S<T, T> {
template<typename U> struct K { };
void f() {
typedef typename S<T, T>::template K<T> Foo;
}
};
}