================ @@ -4446,6 +4446,24 @@ CompareStandardConversionSequences(Sema &S, SourceLocation Loc, T1 = S.Context.getQualifiedType(UnqualT1, T1Quals); if (isa<ArrayType>(T2) && T2Quals) T2 = S.Context.getQualifiedType(UnqualT2, T2Quals); + + if (S.getLangOpts().MSVCReferenceBinding && + S.Context.hasSameType(SCS1.getFromType(), SCS2.getFromType()) && + !SCS1.getFromType().hasQualifiers() && SCS1.BindsToRvalue && + SCS2.BindsToRvalue) { + + // When binding a user-defined type temporary to an lvalue MSVC will + // pick `const T&` over `T&` when binding an unqualified `T&&`. + // Therefore we want to pick the more qualified const overload in this + // specific case. ---------------- MaxEW707 wrote:
https://godbolt.org/z/xaPE6rMc1 for reference on this overload resolution case. https://github.com/llvm/llvm-project/pull/99833 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits