Ticket #8337: Fix false positive in copy constructor detection. (#1040)

This commit is contained in:
Simon Martin 2018-01-20 14:46:09 +01:00 committed by amai2012
parent 6f2d4361df
commit b4f32206af
2 changed files with 8 additions and 1 deletions

View File

@ -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;
}

View File

@ -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[]) {