@@ -245,6 +245,7 @@ void StandardConversionSequence::setAsIdentityConversion() {
245
245
IsLvalueReference = true;
246
246
BindsToFunctionLvalue = false;
247
247
BindsToRvalue = false;
248
+ IsImplicitObjectArgumentQualificationConversion = false;
248
249
BindsImplicitObjectArgumentWithoutRefQualifier = false;
249
250
ObjCLifetimeConversionBinding = false;
250
251
FromBracedInitList = false;
@@ -5317,6 +5318,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
5317
5318
ICS.Standard.DirectBinding = BindsDirectly;
5318
5319
ICS.Standard.IsLvalueReference = !isRValRef;
5319
5320
ICS.Standard.BindsToFunctionLvalue = T2->isFunctionType();
5321
+ ICS.Standard.IsImplicitObjectArgumentQualificationConversion = false;
5320
5322
ICS.Standard.BindsToRvalue = InitCategory.isRValue();
5321
5323
ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier = false;
5322
5324
ICS.Standard.ObjCLifetimeConversionBinding =
@@ -5496,6 +5498,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
5496
5498
ICS.Standard.IsLvalueReference = !isRValRef;
5497
5499
ICS.Standard.BindsToFunctionLvalue = false;
5498
5500
ICS.Standard.BindsToRvalue = true;
5501
+ ICS.Standard.IsImplicitObjectArgumentQualificationConversion = false;
5499
5502
ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier = false;
5500
5503
ICS.Standard.ObjCLifetimeConversionBinding = false;
5501
5504
} else if (ICS.isUserDefined()) {
@@ -5518,6 +5521,8 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
5518
5521
ICS.UserDefined.After.IsLvalueReference = !isRValRef;
5519
5522
ICS.UserDefined.After.BindsToFunctionLvalue = false;
5520
5523
ICS.UserDefined.After.BindsToRvalue = !LValRefType;
5524
+ ICS.UserDefined.After.IsImplicitObjectArgumentQualificationConversion =
5525
+ false;
5521
5526
ICS.UserDefined.After.BindsImplicitObjectArgumentWithoutRefQualifier = false;
5522
5527
ICS.UserDefined.After.ObjCLifetimeConversionBinding = false;
5523
5528
ICS.UserDefined.After.FromBracedInitList = false;
@@ -5802,6 +5807,7 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
5802
5807
StandardConversionSequence &SCS = Result.isStandard() ? Result.Standard :
5803
5808
Result.UserDefined.After;
5804
5809
SCS.ReferenceBinding = true;
5810
+ SCS.IsImplicitObjectArgumentQualificationConversion = false;
5805
5811
SCS.IsLvalueReference = ToType->isLValueReferenceType();
5806
5812
SCS.BindsToRvalue = true;
5807
5813
SCS.BindsToFunctionLvalue = false;
@@ -5999,8 +6005,12 @@ static ImplicitConversionSequence TryObjectArgumentInitialization(
5999
6005
// affects the conversion rank.
6000
6006
QualType ClassTypeCanon = S.Context.getCanonicalType(ClassType);
6001
6007
ImplicitConversionKind SecondKind;
6002
- if (ClassTypeCanon == FromTypeCanon.getLocalUnqualifiedType()) {
6008
+ bool IsQualificationConversion = false;
6009
+ if (ImplicitParamType.getCanonicalType() == FromTypeCanon) {
6003
6010
SecondKind = ICK_Identity;
6011
+ } else if (ClassTypeCanon == FromTypeCanon.getLocalUnqualifiedType()) {
6012
+ SecondKind = ICK_Identity;
6013
+ IsQualificationConversion = true;
6004
6014
} else if (S.IsDerivedFrom(Loc, FromType, ClassType)) {
6005
6015
SecondKind = ICK_Derived_To_Base;
6006
6016
} else if (!Method->isExplicitObjectMemberFunction()) {
@@ -6041,6 +6051,8 @@ static ImplicitConversionSequence TryObjectArgumentInitialization(
6041
6051
ICS.Standard.setFromType(FromType);
6042
6052
ICS.Standard.setAllToTypes(ImplicitParamType);
6043
6053
ICS.Standard.ReferenceBinding = true;
6054
+ ICS.Standard.IsImplicitObjectArgumentQualificationConversion =
6055
+ IsQualificationConversion;
6044
6056
ICS.Standard.DirectBinding = true;
6045
6057
ICS.Standard.IsLvalueReference = Method->getRefQualifier() != RQ_RValue;
6046
6058
ICS.Standard.BindsToFunctionLvalue = false;
0 commit comments