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
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10613,6 +10613,21 @@ class TestOther : public TestFixture {
10613
10613
ASSERT_EQUALS(
10614
10614
"[test.cpp:2:10]: (style) Variable 'a' can be declared as pointer to const [constVariablePointer]\n",
10615
10615
errout_str());
10616
+
10617
+
check("std::string f() {\n" // #14534
10618
+
" std::string s = \"abc\";\n"
10619
+
" s = \"def\";\n"
10620
+
" return s;\n"
10621
+
"}\n"
10622
+
"const char* g() {\n"
10623
+
" const char* p = \"abc\";\n"
10624
+
" p = \"def\";\n"
10625
+
" return p;\n"
10626
+
"}");
10627
+
ASSERT_EQUALS(
10628
+
"[test.cpp:2:19] -> [test.cpp:3:7]: (style) Redundant initialization for 's'. The initialized value is overwritten before it is read. [redundantInitialization]\n"
10629
+
"[test.cpp:7:19] -> [test.cpp:8:7]: (style) Redundant initialization for 'p'. The initialized value is overwritten before it is read. [redundantInitialization]\n",
0 commit comments