You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testother.cpp
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9886,6 +9886,19 @@ class TestOther : public TestFixture {
9886
9886
" if (s.empty()) {}\n"
9887
9887
"}\n");
9888
9888
ASSERT_EQUALS("[test.cpp:6:16]: (performance, inconclusive) Use const reference for 's' to avoid unnecessary data copying. [redundantCopyLocalConst]\n", errout_str());
9889
+
9890
+
check("void f1(const std::string& s) {\n"
9891
+
" std::string s1 = s;\n"
9892
+
" (void)s1;\n"
9893
+
"}\n"
9894
+
"void f2() {\n"
9895
+
" const std::string s;\n"
9896
+
" std::string s1 = s;\n"
9897
+
" (void)s1;\n"
9898
+
"}\n");
9899
+
ASSERT_EQUALS("[test.cpp:2:17]: (performance, inconclusive) Use const reference for 's1' to avoid unnecessary data copying. [redundantCopyLocalConst]\n"
9900
+
"[test.cpp:7:17]: (performance, inconclusive) Use const reference for 's1' to avoid unnecessary data copying. [redundantCopyLocalConst]\n",
0 commit comments