From 5875038f5c333b8bd013f62950281618d08e36a8 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sat, 5 Mar 2011 20:06:51 +0000 Subject: [PATCH] When substituting in for a template name, do not produce a qualified template name as the result of substitution. The qualifier is handled separately by the tree transformer, so we would end up in an inconsistent state. This is actually the last bit of PR9016, and possibly also fixes PR8965. It takes Boost.Icl from "epic fail" down to a single failure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127108 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplateInstantiate.cpp | 7 +++++++ test/SemaTemplate/issue150.cpp | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 4108e9fd6f..6fb6ea270b 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -967,6 +967,13 @@ TemplateName TemplateInstantiator::TransformTemplateName(CXXScopeSpec &SS, TemplateName Template = Arg.getAsTemplate(); assert(!Template.isNull() && Template.getAsTemplateDecl() && "Wrong kind of template template argument"); + + // We don't ever want to substitute for a qualified template name, since + // the qualifier is handled separately. So, look through the qualified + // template name to its underlying declaration. + if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName()) + Template = TemplateName(QTN->getTemplateDecl()); + return Template; } } diff --git a/test/SemaTemplate/issue150.cpp b/test/SemaTemplate/issue150.cpp index 6124d05413..af3b93c907 100644 --- a/test/SemaTemplate/issue150.cpp +++ b/test/SemaTemplate/issue150.cpp @@ -83,7 +83,7 @@ namespace PR9016 { }; template class Compare = less, + template class Compare = PR9016::less, class = typename interval_type_default<_T,Compare>::type, template class = allocator> class IntervalSet> struct ZZZ @@ -92,7 +92,7 @@ namespace PR9016 { }; template class Compare = less, + template class Compare = PR9016::less, class = typename interval_type_default<_T,Compare>::type, template class = allocator> class IntervalSet> void int40() -- 2.40.0