summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-13 21:01:28 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-13 21:01:28 +0000
commit0950e41b73587a71ee66c88cf8db0dfff343a8cf (patch)
treea7d6054a981badf7424c934d5e12969bb3da8070 /clang/lib/Sema/SemaTemplate.cpp
parent5b86bf527ea41117edac3728e6d803d8723de888 (diff)
downloadbcm5719-llvm-0950e41b73587a71ee66c88cf8db0dfff343a8cf.tar.gz
bcm5719-llvm-0950e41b73587a71ee66c88cf8db0dfff343a8cf.zip
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
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp9
1 files changed, 8 insertions, 1 deletions
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;
OpenPOWER on IntegriCloud