Instantiation support for 'this'
llvm-svn: 71886
This commit is contained in:
@@ -47,6 +47,7 @@ namespace {
|
||||
OwningExprResult VisitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *E);
|
||||
OwningExprResult VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E);
|
||||
OwningExprResult VisitImplicitCastExpr(ImplicitCastExpr *E);
|
||||
OwningExprResult VisitCXXThisExpr(CXXThisExpr *E);
|
||||
|
||||
// Base case. I'm supposed to ignore this.
|
||||
Sema::OwningExprResult VisitStmt(Stmt *S) {
|
||||
@@ -418,6 +419,17 @@ Sema::OwningExprResult TemplateExprInstantiator::VisitImplicitCastExpr(
|
||||
return SemaRef.Owned(ICE);
|
||||
}
|
||||
|
||||
Sema::OwningExprResult
|
||||
TemplateExprInstantiator::VisitCXXThisExpr(CXXThisExpr *E) {
|
||||
QualType ThisType =
|
||||
cast<CXXMethodDecl>(SemaRef.CurContext)->getThisType(SemaRef.Context);
|
||||
|
||||
CXXThisExpr *TE =
|
||||
new (SemaRef.Context) CXXThisExpr(E->getLocStart(), ThisType);
|
||||
|
||||
return SemaRef.Owned(TE);
|
||||
}
|
||||
|
||||
Sema::OwningExprResult
|
||||
Sema::InstantiateExpr(Expr *E, const TemplateArgumentList &TemplateArgs) {
|
||||
TemplateExprInstantiator Instantiator(*this, TemplateArgs);
|
||||
|
||||
@@ -75,3 +75,11 @@ struct ConvertibleToInt {
|
||||
|
||||
template struct X6<ConvertibleToInt, float, char>;
|
||||
template struct X6<bool, int, int*>; // expected-note{{instantiation}}
|
||||
|
||||
template <typename T> struct X7 {
|
||||
void f() {
|
||||
void *v = this;
|
||||
}
|
||||
};
|
||||
|
||||
template struct X7<int>;
|
||||
|
||||
Reference in New Issue
Block a user