diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 92b304b00..5bf6ca913 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -924,7 +924,7 @@ void SymbolDatabase::createSymbolDatabaseCopyAndMoveConstructors() if (firstArg->type() == scope->definedType) { if (firstArg->isRValueReference()) func->type = Function::eMoveConstructor; - else if (firstArg->isReference()) + else if (firstArg->isReference() && !firstArg->isPointer()) func->type = Function::eCopyConstructor; } diff --git a/test/testclass.cpp b/test/testclass.cpp index e2dd664a1..7399f0bf8 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -287,6 +287,13 @@ private: " }\n" "};\n"); ASSERT_EQUALS("", errout.str()); + + // #8337 - False positive in copy constructor detection + checkCopyCtorAndEqOperator("struct StaticListNode {\n" + " StaticListNode(StaticListNode*& prev) : m_next(0) {}\n" + " StaticListNode* m_next;\n" + "};"); + ASSERT_EQUALS("", errout.str()); } void checkExplicitConstructors(const char code[]) {