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
{{ message }}
Repository navigation
Commit f207126
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: test/testother.cpp
+22-6Lines changed: 22 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -11569,16 +11569,32 @@ class TestOther : public TestFixture {
11569
11569
" z = 0;\n"
11570
11570
" return z;\n"
11571
11571
"}\n");
11572
-
ASSERT_EQUALS("[test.cpp:4:7]: style: Variable 'x' is reassigned a value before the old one has been used. [redundantAssignment]\n"
11573
-
"[test.cpp:3:17]: note: x is assigned\n"
11572
+
ASSERT_EQUALS("[test.cpp:4:7]: style: Redundant initialization for 'x'. The initialized value is overwritten before it is read. [redundantInitialization]\n"
11573
+
"[test.cpp:3:17]: note: x is initialized\n"
11574
11574
"[test.cpp:4:7]: note: x is overwritten\n"
11575
-
"[test.cpp:5:7]: style: Variable 'y' is reassigned a value before the old one has been used. [redundantAssignment]\n"
11576
-
"[test.cpp:3:17]: note: y is assigned\n"
11575
+
"[test.cpp:5:7]: style: Redundant initialization for 'y'. The initialized value is overwritten before it is read. [redundantInitialization]\n"
11576
+
"[test.cpp:3:17]: note: y is initialized\n"
11577
11577
"[test.cpp:5:7]: note: y is overwritten\n"
11578
-
"[test.cpp:11:7]: style: Variable 'z' is reassigned a value before the old one has been used. [redundantAssignment]\n"
11579
-
"[test.cpp:10:14]: note: z is assigned\n"
11578
+
"[test.cpp:11:7]: style: Redundant initialization for 'z'. The initialized value is overwritten before it is read. [redundantInitialization]\n"
11579
+
"[test.cpp:10:14]: note: z is initialized\n"
11580
11580
"[test.cpp:11:7]: note: z is overwritten\n",
11581
11581
errout_str());
11582
+
11583
+
check("struct S {\n"
11584
+
" int a, b;\n"
11585
+
"};\n"
11586
+
"void f(S& s) {\n"
11587
+
" auto& [x, y] = s;\n"
11588
+
" y = 1;\n"
11589
+
"}\n"
11590
+
"int f(S s) {\n"
11591
+
" auto [x, y] = s;\n"
11592
+
" y = 1;\n"
11593
+
"}\n");
11594
+
ASSERT_EQUALS("[test.cpp:10:7]: style: Redundant initialization for 'y'. The initialized value is overwritten before it is read. [redundantInitialization]\n"
0 commit comments