diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-13 05:23:25 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-13 05:23:25 +0000 |
commit | af050cb73ac43125b5146e43156036a76d031415 (patch) | |
tree | fa9a55ccd6bd8a9f960d6fe0f96bd3fbf8c682e7 /clang/lib/Sema/SemaTemplate.cpp | |
parent | 5e7f70593444d7a79d388075b61de5087701e2e1 (diff) | |
download | bcm5719-llvm-af050cb73ac43125b5146e43156036a76d031415.tar.gz bcm5719-llvm-af050cb73ac43125b5146e43156036a76d031415.zip |
Permit the use of typedefs of class template specializations in
qualified declarator-ids. This patch is actually due to Cornelius;
fixes PR6179.
llvm-svn: 96082
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index c2f0fbc641a..10e411f5825 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -1235,18 +1235,14 @@ Sema::MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, // such a member, the member declaration shall be preceded by a // template<> for each enclosing class template that is // explicitly specialized. - // We interpret this as forbidding typedefs of template - // specializations in the scope specifiers of out-of-line decls. - if (const TypedefType *TT = dyn_cast<TypedefType>(T)) { - const Type *UnderlyingT = TT->LookThroughTypedefs().getTypePtr(); - if (isa<TemplateSpecializationType>(UnderlyingT)) - // FIXME: better source location information. - Diag(DeclStartLoc, diag::err_typedef_in_def_scope) << QualType(T,0); - T = UnderlyingT; - } + // + // Following the existing practice of GNU and EDG, we allow a typedef of a + // template specialization type. + if (const TypedefType *TT = dyn_cast<TypedefType>(T)) + T = TT->LookThroughTypedefs().getTypePtr(); if (const TemplateSpecializationType *SpecType - = dyn_cast<TemplateSpecializationType>(T)) { + = dyn_cast<TemplateSpecializationType>(T)) { TemplateDecl *Template = SpecType->getTemplateName().getAsTemplateDecl(); if (!Template) continue; // FIXME: should this be an error? probably... |