aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2024-05-24 11:06:06 +0200
committerFriedemann Kleint <[email protected]>2024-05-24 11:26:12 +0200
commite4a9790b57d74352c1bc44cf1bda60b40007c95f (patch)
treee430d06101175132c4955e24e1801b901e808a6e /sources/shiboken6/tests/libsample
parente181819c1d8d5c2de2dbb18926cf14c8f470e793 (diff)
libsample: Fix warnings about ambiguous comparison in C++ 20
Make the comparison operators const. Pick-to: 6.7 6.5 Change-Id: Ie5169da64e8cc5e0ec4c01ae14f464c85efed3ce Reviewed-by: Adrian Herrmann <[email protected]>
Diffstat (limited to 'sources/shiboken6/tests/libsample')
-rw-r--r--sources/shiboken6/tests/libsample/derived.h2
-rw-r--r--sources/shiboken6/tests/libsample/point.cpp2
-rw-r--r--sources/shiboken6/tests/libsample/point.h2
-rw-r--r--sources/shiboken6/tests/libsample/pointf.cpp2
-rw-r--r--sources/shiboken6/tests/libsample/pointf.h2
5 files changed, 5 insertions, 5 deletions
diff --git a/sources/shiboken6/tests/libsample/derived.h b/sources/shiboken6/tests/libsample/derived.h
index b7736c37a..cf95cb601 100644
--- a/sources/shiboken6/tests/libsample/derived.h
+++ b/sources/shiboken6/tests/libsample/derived.h
@@ -26,7 +26,7 @@ public:
public:
void uselessMethod() {}
SomeInnerClass operator+(const SomeInnerClass &other) { return other; }
- bool operator==(const SomeInnerClass &) { return true; }
+ bool operator==(const SomeInnerClass &) const { return true; }
};
explicit Derived(int id = -1) noexcept;
diff --git a/sources/shiboken6/tests/libsample/point.cpp b/sources/shiboken6/tests/libsample/point.cpp
index b8630eb1e..0a28e877f 100644
--- a/sources/shiboken6/tests/libsample/point.cpp
+++ b/sources/shiboken6/tests/libsample/point.cpp
@@ -34,7 +34,7 @@ void Point::show() const
std::cout << "(x: " << m_x << ", y: " << m_y << ")";
}
-bool Point::operator==(const Point &other)
+bool Point::operator==(const Point &other) const
{
return m_x == other.m_x && m_y == other.m_y;
}
diff --git a/sources/shiboken6/tests/libsample/point.h b/sources/shiboken6/tests/libsample/point.h
index 59e0236d5..7e5d128ab 100644
--- a/sources/shiboken6/tests/libsample/point.h
+++ b/sources/shiboken6/tests/libsample/point.h
@@ -38,7 +38,7 @@ public:
// The != operator is not implemented for the purpose of testing
// for the absense of the __ne__ method in the Python binding.
- bool operator==(const Point &other);
+ bool operator==(const Point &other) const;
Point operator+(const Point &other);
Point operator-(const Point &other);
diff --git a/sources/shiboken6/tests/libsample/pointf.cpp b/sources/shiboken6/tests/libsample/pointf.cpp
index 6b39f73a9..736a5c6b5 100644
--- a/sources/shiboken6/tests/libsample/pointf.cpp
+++ b/sources/shiboken6/tests/libsample/pointf.cpp
@@ -26,7 +26,7 @@ void PointF::show() const
std::cout << "(x: " << m_x << ", y: " << m_y << ")";
}
-bool PointF::operator==(const PointF &other)
+bool PointF::operator==(const PointF &other) const
{
return m_x == other.m_x && m_y == other.m_y;
}
diff --git a/sources/shiboken6/tests/libsample/pointf.h b/sources/shiboken6/tests/libsample/pointf.h
index bb50b5c6d..49e009467 100644
--- a/sources/shiboken6/tests/libsample/pointf.h
+++ b/sources/shiboken6/tests/libsample/pointf.h
@@ -31,7 +31,7 @@ public:
// The != operator is not implemented for the purpose of testing
// for the absence of the __ne__ method in the Python binding.
- bool operator==(const PointF &other);
+ bool operator==(const PointF &other) const;
PointF operator+(const PointF &other);
PointF operator-(const PointF &other);