diff options
author | Marc Mutz <marc.mutz@qt.io> | 2021-11-16 14:43:51 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2021-11-17 14:19:13 +0100 |
commit | ec291f9974ba6d25148955a0b9e55b30c589a9be (patch) | |
tree | 43d1b461b0d0d482b03e16f83b333817a9ed26a6 /tests | |
parent | 9f3f8da7454a33d5cae7d581c82672e999609d66 (diff) |
QGeometryFactory: don't make op== virtual
That's too clever, and it backfires with compilation errors in C++20
mode:
qt3d/tests/auto/render/meshfunctors/tst_meshfunctors.cpp:129:29: error: ambiguous overload for ‘operator==’ (operand types are ‘MeshFunctorA’ and ‘MeshFunctorB’)
129 | QVERIFY(!(*functorA == *functorB));
| ~~~~~~~~~ ^~ ~~~~~~~~~
| | |
| MeshFunctorA MeshFunctorB
qt3d/tests/auto/render/meshfunctors/tst_meshfunctors.cpp:72:10: note: candidate: ‘virtual bool MeshFunctorB::operator==(const Qt3DCore::QGeometryFactory&) const’ (reversed)
72 | bool operator ==(const Qt3DCore::QGeometryFactory &other) const override
| ^~~~~~~~
qt3d/tests/auto/render/meshfunctors/tst_meshfunctors.cpp:50:10: note: candidate: ‘virtual bool MeshFunctorA::operator==(const Qt3DCore::QGeometryFactory&) const’
50 | bool operator ==(const Qt3DCore::QGeometryFactory &other) const override
| ^~~~~~~~
Fix by providing a symmetric operator== for QGeometryFactory that
delegates to a virtual equals() method.
Pick-to: 6.2 5.15
Change-Id: I23d29ad1b16075629132f2b4757c5810d5615a36
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/render/meshfunctors/tst_meshfunctors.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/render/meshfunctors/tst_meshfunctors.cpp b/tests/auto/render/meshfunctors/tst_meshfunctors.cpp index fc22b17f7..bf8d9f2af 100644 --- a/tests/auto/render/meshfunctors/tst_meshfunctors.cpp +++ b/tests/auto/render/meshfunctors/tst_meshfunctors.cpp @@ -47,7 +47,7 @@ public: return nullptr; } - bool operator ==(const Qt3DCore::QGeometryFactory &other) const override + bool equals(const Qt3DCore::QGeometryFactory &other) const override { return Qt3DCore::functor_cast<MeshFunctorA>(&other); } @@ -69,7 +69,7 @@ public: return nullptr; } - bool operator ==(const Qt3DCore::QGeometryFactory &other) const override + bool equals(const Qt3DCore::QGeometryFactory &other) const override { return Qt3DCore::functor_cast<MeshFunctorB>(&other); } @@ -86,7 +86,7 @@ public: ~MeshFunctorASub() {} - bool operator ==(const Qt3DCore::QGeometryFactory &other) const override + bool equals(const Qt3DCore::QGeometryFactory &other) const override { return Qt3DCore::functor_cast<MeshFunctorASub>(&other); } |