[cfe-commits] r67063 - /cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
Anders Carlsson
andersca at mac.com
Mon Mar 16 17:28:02 PDT 2009
Author: andersca
Date: Mon Mar 16 19:28:02 2009
New Revision: 67063
URL: http://llvm.org/viewvc/llvm-project?rev=67063&view=rev
Log:
Handle ImplicitCastExprs when instantiating templates.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=67063&r1=67062&r2=67063&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Mon Mar 16 19:28:02 2009
@@ -617,7 +617,8 @@
OwningExprResult VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E);
OwningExprResult VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
OwningExprResult VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E);
-
+ OwningExprResult VisitImplicitCastExpr(ImplicitCastExpr *E);
+
// Base case. I'm supposed to ignore this.
Sema::OwningExprResult VisitStmt(Stmt *S) {
S->dump();
@@ -908,6 +909,21 @@
return SemaRef.ExprError();
}
+Sema::OwningExprResult TemplateExprInstantiator::VisitImplicitCastExpr(
+ ImplicitCastExpr *E) {
+ assert(!E->isTypeDependent() && "Implicit casts must have known types");
+
+ Sema::OwningExprResult SubExpr = Visit(E->getSubExpr());
+ if (SubExpr.isInvalid())
+ return SemaRef.ExprError();
+
+ ImplicitCastExpr *ICE =
+ new (SemaRef.Context) ImplicitCastExpr(E->getType(),
+ (Expr *)SubExpr.release(),
+ E->isLvalueCast());
+ return SemaRef.Owned(ICE);
+}
+
Sema::OwningExprResult
Sema::InstantiateExpr(Expr *E, const TemplateArgument *TemplateArgs,
unsigned NumTemplateArgs) {
More information about the cfe-commits
mailing list