diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 3ac4d133fe..03964587e9 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -2668,6 +2668,9 @@ Sema::BuildMemberReferenceExpr(ExprArg BaseArg, QualType BaseType, if (Result.get()) return move(Result); + + // LookupMemberExpr can modify Base, and thus change BaseType + BaseType = Base->getType(); } return BuildMemberReferenceExpr(ExprArg(*this, Base), BaseType,