<rdar://problem/13170740> Be a little more careful when instantiating 'this' expressions.

llvm-svn: 176731
This commit is contained in:
Douglas Gregor 2013-03-08 22:43:48 +00:00
parent 058927b8d4
commit f9b76cd8b5
1 changed files with 7 additions and 2 deletions

View File

@ -7167,9 +7167,14 @@ TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) {
QualType T;
if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(DC))
T = MD->getThisType(getSema().Context);
else
else if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(DC)) {
T = getSema().Context.getPointerType(
getSema().Context.getRecordType(cast<CXXRecordDecl>(DC)));
getSema().Context.getRecordType(Record));
} else {
assert(SemaRef.Context.getDiagnostics().hasErrorOccurred() &&
"this in the wrong scope?");
return ExprError();
}
if (!getDerived().AlwaysRebuild() && T == E->getType()) {
// Make sure that we capture 'this'.