Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ void SymbolDatabase::createSymbolDatabaseSetFunctionPointers(bool firstPass)

tok->function(function);

if (tok->strAt(1) != "(")
if (!function->isConstructor() && tok->strAt(1) != "(")
const_cast<Function *>(function)->functionPointerUsage = tok;
}
}
Expand Down
10 changes: 10 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4150,6 +4150,16 @@ class TestOther : public TestFixture {
" S s2{ cb };\n"
"}\n");
ASSERT_EQUALS("[test.cpp:6:11] -> [test.cpp:2:21]: (performance) Function parameter 's' should be passed by const reference. However it seems that 'cb' is a callback function. [passedByValueCallback]\n", errout_str());

check("struct S {\n" // #14696
" explicit S(std::string s = {}) {}\n"
"};\n"
"struct T {\n"
" explicit T(std::string* s = {}) {}\n"
"};\n");
ASSERT_EQUALS("[test.cpp:2:28]: (performance) Function parameter 's' should be passed by const reference. [passedByValue]\n"
"[test.cpp:5:29]: (style) Parameter 's' can be declared as pointer to const [constParameterPointer]\n",
errout_str());
}

void constPointer() {
Expand Down
Loading