mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
AK/Complex: C++20-compatible comparison operators
Problem: - Clang correctly reports non-`const` member function comparison operators as ambiguous. Solution: - Make them `const`.
This commit is contained in:
parent
97f4aa166a
commit
0ac02b9084
Notes:
sideshowbarker
2024-07-18 19:25:44 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/0ac02b9084c Pull-request: https://github.com/SerenityOS/serenity/pull/6458 Reviewed-by: https://github.com/alimpfard
@ -243,13 +243,13 @@ public:
|
||||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr bool operator==(const Complex<U>& a)
|
||||
constexpr bool operator==(const Complex<U>& a) const
|
||||
{
|
||||
return (this->real() == a.real()) && (this->imag() == a.imag());
|
||||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic U>
|
||||
constexpr bool operator!=(const Complex<U>& a)
|
||||
constexpr bool operator!=(const Complex<U>& a) const
|
||||
{
|
||||
return !(*this == a);
|
||||
}
|
||||
|
@ -119,7 +119,14 @@ TEST_CASE(assign_moved_self)
|
||||
{
|
||||
RefPtr<Object> object = adopt(*new Object);
|
||||
EXPECT_EQ(object->ref_count(), 1u);
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wself-move"
|
||||
#endif
|
||||
object = move(object);
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
EXPECT_EQ(object->ref_count(), 1u);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user