diff options
author | Friedemann Kleint <[email protected]> | 2022-02-14 08:59:55 +0100 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2022-02-15 11:38:43 +0100 |
commit | 27bcf6ad7afb7b5415c6c8dc79331f73e068923b (patch) | |
tree | 5f1ab8c50ddb5bc9901a90e5f3253d7370f7b047 /sources/shiboken6/tests/libsample | |
parent | 89ea1b0b6579bb71be0fb4fab1ab36d116fcec78 (diff) |
shiboken6/tests: Fix compilation with MSVC 2022 in C++ 20 mode
Make operator==() of test class Size an inline friend like operator!=().
It seems that in C++ 20 mode, the compiler tries to include operator==() in
overload checks of operator!=() (rewriting expressions) and hits on an
amiguity when operator==() is implemented as member (arguable a compiler
bug):
size_wrapper.cpp(921): error C2666: "Size::operator ==": 3 overloads have similar conversions
Pick-to: 6.2
Change-Id: Ia57d531adca272be29dd4c4f7ef322450986033e
Reviewed-by: Shyamnath Premnadh <[email protected]>
Reviewed-by: Christian Tismer <[email protected]>
Diffstat (limited to 'sources/shiboken6/tests/libsample')
-rw-r--r-- | sources/shiboken6/tests/libsample/size.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sources/shiboken6/tests/libsample/size.h b/sources/shiboken6/tests/libsample/size.h index 76502b416..e4f3805b9 100644 --- a/sources/shiboken6/tests/libsample/size.h +++ b/sources/shiboken6/tests/libsample/size.h @@ -45,11 +45,6 @@ public: inline double calculateArea() const { return m_width * m_height; } // Comparison Operators - inline bool operator==(const Size& other) - { - return m_width == other.m_width && m_height == other.m_height; - } - inline bool operator<(const Size& other) { return calculateArea() < other.calculateArea(); @@ -117,6 +112,7 @@ public: // TODO: add ++size, size++, --size, size-- // External operators + friend inline bool operator==(const Size&, const Size&); friend inline bool operator!=(const Size&, const Size&); friend inline const Size operator+(const Size&, const Size&); friend inline const Size operator-(const Size&, const Size&); @@ -142,6 +138,11 @@ inline bool operator!=(const Size& s1, const Size& s2) return s1.m_width != s2.m_width || s1.m_height != s2.m_height; } +inline bool operator==(const Size& s1, const Size& s2) +{ + return s1.m_width == s2.m_width && s1.m_height == s2.m_height; +} + inline bool operator<(double area, const Size& s) { return area < s.calculateArea(); |