https://github.com/hazohelet updated https://github.com/llvm/llvm-project/pull/65248:
>From eee4c3aee9350be51c9333f284810ffebd9d1663 Mon Sep 17 00:00:00 2001 From: Takuya Shimizu <shimizu2...@gmail.com> Date: Mon, 4 Sep 2023 16:23:00 +0900 Subject: [PATCH 1/3] [clang][MSExtentions] Fix invalid overload failure about the loss of `__unaligned` qualifier Loss of `__unaligned` qualifier does not invalidate overload candidates. This fixes a regression reported in https://reviews.llvm.org/D153690 --- clang/lib/Sema/SemaOverload.cpp | 8 +++++--- clang/test/SemaCXX/MicrosoftExtensions.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 5d0299dfa752f92..9833d0d312186b6 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -5557,9 +5557,11 @@ TryObjectArgumentInitialization(Sema &S, SourceLocation Loc, QualType FromType, // First check the qualifiers. QualType FromTypeCanon = S.Context.getCanonicalType(FromType); - if (ImplicitParamType.getCVRQualifiers() - != FromTypeCanon.getLocalCVRQualifiers() && - !ImplicitParamType.isAtLeastAsQualifiedAs(FromTypeCanon)) { + // MSVC ignores __unaligned qualifier for overload candidates; do the same. + if (ImplicitParamType.getCVRQualifiers() != + FromTypeCanon.getLocalCVRQualifiers() && + !ImplicitParamType.isAtLeastAsQualifiedAs( + withoutUnaligned(S.Context, FromTypeCanon))) { ICS.setBad(BadConversionSequence::bad_qualifiers, FromType, ImplicitParamType); return ICS; diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp b/clang/test/SemaCXX/MicrosoftExtensions.cpp index 960030d44f0c155..71618048014cc74 100644 --- a/clang/test/SemaCXX/MicrosoftExtensions.cpp +++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp @@ -589,6 +589,17 @@ namespace PR42089 { __attribute__((nothrow)) void S::Bar(){} } +namespace UnalignedConv { +struct S { + bool operator==(int) const; +}; + +int func() { + S __unaligned s; + return s == 42; +} +} + #elif TEST2 // Check that __unaligned is not recognized if MS extensions are not enabled >From d76263dacae363fe8b82e40babada9fa50a1f830 Mon Sep 17 00:00:00 2001 From: Takuya Shimizu <shimizu2...@gmail.com> Date: Tue, 5 Sep 2023 01:09:47 +0900 Subject: [PATCH 2/3] Dummy commit to trigger CI build/test --- clang/test/SemaCXX/MicrosoftExtensions.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp b/clang/test/SemaCXX/MicrosoftExtensions.cpp index 71618048014cc74..7286217b1644f3e 100644 --- a/clang/test/SemaCXX/MicrosoftExtensions.cpp +++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp @@ -600,6 +600,7 @@ int func() { } } + #elif TEST2 // Check that __unaligned is not recognized if MS extensions are not enabled >From 4f184b9b6f2f2e236fea2c7d8e358cd4779ea1ed Mon Sep 17 00:00:00 2001 From: Takuya Shimizu <shimizu2...@gmail.com> Date: Tue, 5 Sep 2023 11:32:28 +0900 Subject: [PATCH 3/3] Add release note --- clang/docs/ReleaseNotes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index c6d2c3466a09622..dbb719eb338dc63 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -211,6 +211,8 @@ Bug Fixes in This Version - Clang now reports ``-Wformat`` for bool value and char specifier confusion in scanf. Fixes (`#64987 <https://github.com/llvm/llvm-project/issues/64987>`_) +- Clang no longer considers the loss of ``__unaligned`` qualifier from objects as + an invalid conversion during method function overload resolution. Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits