aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateDeduction.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-08-28 20:50:45 +0000
committerDouglas Gregor <dgregor@apple.com>2009-08-28 20:50:45 +0000
commit357bbd022c1d340c8e255aea7a684ddb34bc76e5 (patch)
tree668efdbda10cd6080ad5057c6922ecb3f0278fce /lib/Sema/SemaTemplateDeduction.cpp
parentc18faf67c366f79035e364944d7df7f281ddf5a4 (diff)
Tighten up the conversion from a single-level template argument list
to a multi-level template argument list by making it explicit. The forced auditing of callers found a bug in the instantiation of member classes inside member templates. I *love* static type systems. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index ec198e0ffb..2253a4e6a7 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -967,8 +967,9 @@ Sema::DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial,
for (unsigned I = 0, N = PartialTemplateArgs.flat_size(); I != N; ++I) {
Decl *Param = const_cast<Decl *>(
ClassTemplate->getTemplateParameters()->getParam(I));
- TemplateArgument InstArg = Subst(PartialTemplateArgs[I],
- *DeducedArgumentList);
+ TemplateArgument InstArg
+ = Subst(PartialTemplateArgs[I],
+ MultiLevelTemplateArgumentList(*DeducedArgumentList));
if (InstArg.isNull()) {
Info.Param = makeTemplateParameter(Param);
Info.FirstArg = PartialTemplateArgs[I];
@@ -1118,10 +1119,10 @@ Sema::SubstituteExplicitTemplateArguments(
PEnd = Function->param_end();
P != PEnd;
++P) {
- QualType ParamType = SubstType((*P)->getType(),
- *ExplicitArgumentList,
- (*P)->getLocation(),
- (*P)->getDeclName());
+ QualType ParamType
+ = SubstType((*P)->getType(),
+ MultiLevelTemplateArgumentList(*ExplicitArgumentList),
+ (*P)->getLocation(), (*P)->getDeclName());
if (ParamType.isNull() || Trap.hasErrorOccurred())
return TDK_SubstitutionFailure;
@@ -1136,10 +1137,11 @@ Sema::SubstituteExplicitTemplateArguments(
= Function->getType()->getAsFunctionProtoType();
assert(Proto && "Function template does not have a prototype?");
- QualType ResultType = SubstType(Proto->getResultType(),
- *ExplicitArgumentList,
- Function->getTypeSpecStartLoc(),
- Function->getDeclName());
+ QualType ResultType
+ = SubstType(Proto->getResultType(),
+ MultiLevelTemplateArgumentList(*ExplicitArgumentList),
+ Function->getTypeSpecStartLoc(),
+ Function->getDeclName());
if (ResultType.isNull() || Trap.hasErrorOccurred())
return TDK_SubstitutionFailure;
@@ -1215,7 +1217,7 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate,
Specialization = cast_or_null<FunctionDecl>(
SubstDecl(FunctionTemplate->getTemplatedDecl(),
FunctionTemplate->getDeclContext(),
- *DeducedArgumentList));
+ MultiLevelTemplateArgumentList(*DeducedArgumentList)));
if (!Specialization)
return TDK_SubstitutionFailure;