@@ -7999,18 +7999,6 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
7999
7999
8000
8000
QualType BaseType = Base->getType();
8001
8001
MayBePseudoDestructor = false;
8002
- if (BaseType->isDependentType()) {
8003
- // If we have a pointer to a dependent type and are using the -> operator,
8004
- // the object type is the type that the pointer points to. We might still
8005
- // have enough information about that type to do something useful.
8006
- if (OpKind == tok::arrow)
8007
- if (const PointerType *Ptr = BaseType->getAs<PointerType>())
8008
- BaseType = Ptr->getPointeeType();
8009
-
8010
- ObjectType = ParsedType::make(BaseType);
8011
- MayBePseudoDestructor = true;
8012
- return Base;
8013
- }
8014
8002
8015
8003
// C++ [over.match.oper]p8:
8016
8004
// [...] When operator->returns, the operator-> is applied to the value
@@ -8025,7 +8013,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
8025
8013
SmallVector<FunctionDecl*, 8> OperatorArrows;
8026
8014
CTypes.insert(Context.getCanonicalType(BaseType));
8027
8015
8028
- while (BaseType->isRecordType ()) {
8016
+ while (BaseType->getAsRecordDecl ()) {
8029
8017
if (OperatorArrows.size() >= getLangOpts().ArrowDepth) {
8030
8018
Diag(OpLoc, diag::err_operator_arrow_depth_exceeded)
8031
8019
<< StartingType << getLangOpts().ArrowDepth << Base->getSourceRange();
@@ -8036,7 +8024,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
8036
8024
}
8037
8025
8038
8026
Result = BuildOverloadedArrowExpr(
8039
- S, Base, OpLoc,
8027
+ Base, OpLoc,
8040
8028
// When in a template specialization and on the first loop iteration,
8041
8029
// potentially give the default diagnostic (with the fixit in a
8042
8030
// separate note) instead of having the error reported back to here
@@ -8100,7 +8088,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
8100
8088
// it's legal for the type to be incomplete if this is a pseudo-destructor
8101
8089
// call. We'll do more incomplete-type checks later in the lookup process,
8102
8090
// so just skip this check for ObjC types.
8103
- if (!BaseType->isRecordType()) {
8091
+ if (BaseType->isDependentType() || !BaseType->isRecordType()) {
8104
8092
ObjectType = ParsedType::make(BaseType);
8105
8093
MayBePseudoDestructor = true;
8106
8094
return Base;
@@ -8111,8 +8099,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
8111
8099
// Unlike the object expression in other contexts, *this is not required to
8112
8100
// be of complete type for purposes of class member access (5.2.5) outside
8113
8101
// the member function body.
8114
- if (!BaseType->isDependentType() &&
8115
- !isThisOutsideMemberFunctionBody(BaseType) &&
8102
+ if (!isThisOutsideMemberFunctionBody(BaseType) &&
8116
8103
RequireCompleteType(OpLoc, BaseType,
8117
8104
diag::err_incomplete_member_access)) {
8118
8105
return CreateRecoveryExpr(Base->getBeginLoc(), Base->getEndLoc(), {Base});
0 commit comments