Skip to content

Commit 5a3582e

Browse files
Update testother.cpp
1 parent 8d34080 commit 5a3582e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/testother.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4150,6 +4150,16 @@ class TestOther : public TestFixture {
41504150
" S s2{ cb };\n"
41514151
"}\n");
41524152
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());
4153+
4154+
check("struct S {\n" // #14696
4155+
" explicit S(std::string s = {}) {}\n"
4156+
"};\n"
4157+
"struct T {\n"
4158+
" explicit T(std::string* s = {}) {}\n"
4159+
"};\n");
4160+
ASSERT_EQUALS("[test.cpp:2:28]: (performance) Function parameter 's' should be passed by const reference. [passedByValue]\n"
4161+
"[test.cpp:5:29]: (style) Parameter 's' can be declared as pointer to const [constParameterPointer]\n",
4162+
errout_str());
41534163
}
41544164

41554165
void constPointer() {

0 commit comments

Comments
 (0)