[PATCH] D153690: [clang][Sema] Remove dead diagnostic for loss of __unaligned qualifier

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 30 04:21:23 PDT 2023


hazohelet added a comment.

In D153690#4624726 <https://reviews.llvm.org/D153690#4624726>, @michael-jabbour-sonarsource wrote:

> The removal of the early return in this patch causes a crash when parsing the following example:
>
>   struct S {
>     bool operator==(int) const;
>   };
>   
>   void func() {
>     S __unaligned s;
>     s == 42;
>   }
>
> See this Compiler Explorer link with a stacktrace: https://godbolt.org/z/n9vscYoYa.
>
> Maybe we want to avoid the call to `DiagnoseBadConversion` here? I think that we don't want `OverloadCandidateSet::BestViableFunction` (called in `Sema::CreateOverloadedBinOp`) to return `OR_No_Viable_Function` in this case?

Thank you for the report and reproducer!
@rnk This reproducer code should be accepted for clang to be aligned with msvc's behavior, correct?

About the fix, there's probably some code that makes a candidate that loses const qualifier invalid, and the __unaligned is likely to be handled in the same place. (I haven't checked the code, so may be off base)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153690/new/

https://reviews.llvm.org/D153690



More information about the cfe-commits mailing list