diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-05-26 22:09:24 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-05-26 22:09:24 +0000 |
commit | 5f8bd59b448576e0ac5996b5247f653b7476ad3e (patch) | |
tree | 30eeaa42ac75029086a266108d3beebfe39e6754 /lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 49d1cd5a09ed3df353371fd7f206674a85e0fb45 (diff) |
Template instantiation for "typeof" for both types and expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72440 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 3c32a21073..86e69997bc 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -414,17 +414,22 @@ TemplateTypeInstantiator::InstantiateTypedefType(const TypedefType *T, QualType TemplateTypeInstantiator::InstantiateTypeOfExprType(const TypeOfExprType *T, unsigned Quals) const { - // FIXME: Implement this - assert(false && "Cannot instantiate TypeOfExprType yet"); - return QualType(); + Sema::OwningExprResult E + = SemaRef.InstantiateExpr(T->getUnderlyingExpr(), TemplateArgs); + if (E.isInvalid()) + return QualType(); + + return SemaRef.Context.getTypeOfExprType(E.takeAs<Expr>()); } QualType TemplateTypeInstantiator::InstantiateTypeOfType(const TypeOfType *T, unsigned Quals) const { - // FIXME: Implement this - assert(false && "Cannot instantiate TypeOfType yet"); - return QualType(); + QualType Underlying = Instantiate(T->getUnderlyingType()); + if (Underlying.isNull()) + return QualType(); + + return SemaRef.Context.getTypeOfType(Underlying); } QualType |