From 354f50f258bf42cf1289fc98514fcb1841d89aa1 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 9 Feb 2024 15:18:40 +0100 Subject: [PATCH] CppEditor: Use a hidden friend to compare BaseEditorDocumentParser::Configuration Posh, and avoids an upcoming warning with C++20: /data/dev/creator/src/plugins/clangcodemodel/clangdclient.cpp:907:40: warning: C++20 says that these are ambiguous, even though the second is reversed: In file included from /data/dev/creator/src/plugins/clangcodemodel/clangdclient.h:6, from /data/dev/creator/src/plugins/clangcodemodel/clangdclient.cpp:4: /data/dev/creator/src/plugins/cppeditor/baseeditordocumentparser.h:37:14: note: candidate 1: 'bool CppEditor::BaseEditorDocumentParser::Configuration::operator==(const CppEditor::BaseEditorDocumentParser::Configuration&)' /data/dev/creator/src/plugins/cppeditor/baseeditordocumentparser.h:37:14: note: candidate 2: 'bool CppEditor::BaseEditorDocumentParser::Configuration::operator==(const CppEditor::BaseEditorDocumentParser::Configuration&)' (reversed) /data/dev/creator/src/plugins/cppeditor/baseeditordocumentparser.h:37:14: note: try making the operator a 'const' member function Change-Id: I98ed9d907b673b9353f540bab2ff7239e018b4f2 Reviewed-by: Reviewed-by: Christian Kandeler --- src/plugins/cppeditor/baseeditordocumentparser.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/cppeditor/baseeditordocumentparser.h b/src/plugins/cppeditor/baseeditordocumentparser.h index 45f6b953990..dce82893848 100644 --- a/src/plugins/cppeditor/baseeditordocumentparser.h +++ b/src/plugins/cppeditor/baseeditordocumentparser.h @@ -34,11 +34,11 @@ public: QByteArray editorDefines; QString preferredProjectPartId; - bool operator==(const Configuration &other) + friend bool operator==(const Configuration &left, const Configuration &right) { - return usePrecompiledHeaders == other.usePrecompiledHeaders - && editorDefines == other.editorDefines - && preferredProjectPartId == other.preferredProjectPartId; + return left.usePrecompiledHeaders == right.usePrecompiledHeaders + && left.editorDefines == right.editorDefines + && left.preferredProjectPartId == right.preferredProjectPartId; } };