From 0950e41b73587a71ee66c88cf8db0dfff343a8cf Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 13 Mar 2009 21:01:28 +0000 Subject: Implement template instantiation for several more kinds of expressions: - C++ function casts, e.g., T(foo) - sizeof(), alignof() More importantly, this allows us to verify that we're performing overload resolution during template instantiation, with argument-dependent lookup and the "cached" results of name lookup from the template definition. llvm-svn: 66947 --- clang/lib/Sema/SemaTemplate.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaTemplate.cpp') diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 6fc45155717..3780259d43b 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -1275,7 +1275,14 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, QualType IntegerType = Context.getCanonicalType(ParamType); if (const EnumType *Enum = IntegerType->getAsEnumType()) IntegerType = Enum->getDecl()->getIntegerType(); - + + if (Arg->isValueDependent()) { + // The argument is value-dependent. Create a new + // TemplateArgument with the converted expression. + Converted->push_back(TemplateArgument(Arg)); + return false; + } + llvm::APInt CanonicalArg(Context.getTypeSize(IntegerType), 0, IntegerType->isSignedIntegerType()); CanonicalArg = Value; -- cgit v1.2.3