@@ -7966,18 +7966,6 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
7966
7966
7967
7967
QualType BaseType = Base->getType();
7968
7968
MayBePseudoDestructor = false;
7969
- if (BaseType->isDependentType()) {
7970
- // If we have a pointer to a dependent type and are using the -> operator,
7971
- // the object type is the type that the pointer points to. We might still
7972
- // have enough information about that type to do something useful.
7973
- if (OpKind == tok::arrow)
7974
- if (const PointerType *Ptr = BaseType->getAs<PointerType>())
7975
- BaseType = Ptr->getPointeeType();
7976
-
7977
- ObjectType = ParsedType::make(BaseType);
7978
- MayBePseudoDestructor = true;
7979
- return Base;
7980
- }
7981
7969
7982
7970
// C++ [over.match.oper]p8:
7983
7971
// [...] When operator->returns, the operator-> is applied to the value
@@ -7992,7 +7980,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
7992
7980
SmallVector<FunctionDecl*, 8> OperatorArrows;
7993
7981
CTypes.insert(Context.getCanonicalType(BaseType));
7994
7982
7995
- while (BaseType->isRecordType ()) {
7983
+ while (BaseType->getAsRecordDecl ()) {
7996
7984
if (OperatorArrows.size() >= getLangOpts().ArrowDepth) {
7997
7985
Diag(OpLoc, diag::err_operator_arrow_depth_exceeded)
7998
7986
<< StartingType << getLangOpts().ArrowDepth << Base->getSourceRange();
@@ -8003,7 +7991,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
8003
7991
}
8004
7992
8005
7993
Result = BuildOverloadedArrowExpr(
8006
- S, Base, OpLoc,
7994
+ Base, OpLoc,
8007
7995
// When in a template specialization and on the first loop iteration,
8008
7996
// potentially give the default diagnostic (with the fixit in a
8009
7997
// separate note) instead of having the error reported back to here
@@ -8029,7 +8017,14 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
8029
8017
}
8030
8018
}
8031
8019
return ExprError();
8020
+ } else if (Result.isUnset()) {
8021
+ // BuildOverloadedArrowExpr returns an empty expression to indicate
8022
+ // that we need to build a dependent overloaded arrow expression.
8023
+ assert(BaseType->isDependentType());
8024
+ BaseType = Context.DependentTy;
8025
+ break;
8032
8026
}
8027
+
8033
8028
Base = Result.get();
8034
8029
if (CXXOperatorCallExpr *OpCall = dyn_cast<CXXOperatorCallExpr>(Base))
8035
8030
OperatorArrows.push_back(OpCall->getDirectCallee());
@@ -8067,7 +8062,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
8067
8062
// it's legal for the type to be incomplete if this is a pseudo-destructor
8068
8063
// call. We'll do more incomplete-type checks later in the lookup process,
8069
8064
// so just skip this check for ObjC types.
8070
- if (!BaseType->isRecordType ()) {
8065
+ if (!BaseType->getAsRecordDecl ()) {
8071
8066
ObjectType = ParsedType::make(BaseType);
8072
8067
MayBePseudoDestructor = true;
8073
8068
return Base;
0 commit comments