mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 04:06:46 +00:00

templated class. When a defaulted operator<=> results in the injection of a defaulted operator==, that operator== can be named by unqualified name within the same class, even if the class is templated. To make this work, perform the transform from defaulted operator<=> to defaulted operator== in the template definition context instead of the template instantiation context. This results in our substituting into a declaration from a context where we don't have a full list of template arguments (or indeed any), for which we are now more careful to not spuriously instantiate declarations that are not dependent on the arguments we're substituting.
11 lines
272 B
C++
11 lines
272 B
C++
// RUN: %clang_cc1 -std=c++20 -verify %s
|
|
// expected-no-diagnostics
|
|
|
|
namespace SpaceshipImpliesEq {
|
|
template<typename T> struct A {
|
|
int operator<=>(const A&) const = default;
|
|
constexpr bool f() { return operator==(*this); }
|
|
};
|
|
static_assert(A<int>().f());
|
|
}
|