[all-commits] [llvm/llvm-project] d4cf20: [Clang][Sema] Don't set instantiated from function...

Krystian Stasiowski via All-commits all-commits at lists.llvm.org
Tue May 7 17:09:40 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4cf20ca37160cb062a9db773d0e6255d6bbc31a
      https://github.com/llvm/llvm-project/commit/d4cf20ca37160cb062a9db773d0e6255d6bbc31a
  Author: Krystian Stasiowski <sdkrystian at gmail.com>
  Date:   2024-05-07 (Tue, 07 May 2024)

  Changed paths:
    M clang-tools-extra/clangd/unittests/FindTargetTests.cpp
    M clang-tools-extra/clangd/unittests/HoverTests.cpp
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/test/CXX/class/class.compare/class.compare.default/p4.cpp

  Log Message:
  -----------
  [Clang][Sema] Don't set instantiated from function when rewriting operator<=> (#91339)

The following snippet causes a crash:
```
template<typename T>
struct A 
{
    bool operator<=>(const A&) const requires true = default;
};

bool f(A<int> a) 
{
    return a != A<int>();
}
```
This occurs because during the rewrite from `operator<=>` to
`operator==`, the "pattern" `operator<=>` function is set as the
instantiated from function for the newly created `operator==` function.
This is obviously incorrect, and this patch fixes it.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list