Skip to content

Commit 46821fe

Browse files
committed
Update C++ variable hiding test
Structured bindings are now handled better, so the false negative related to structured bindings is now a true positive.
1 parent a73cdf3 commit 46821fe

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
| hiding.cpp:6:17:6:17 | i | Variable i hides another variable of the same name (on $@). | hiding.cpp:4:13:4:13 | i | line 4 |
22
| hiding.cpp:18:15:18:15 | k | Variable k hides another variable of the same name (on $@). | hiding.cpp:15:11:15:11 | k | line 15 |
3+
| hiding.cpp:38:11:38:11 | x | Variable x hides another variable of the same name (on $@). | hiding.cpp:36:9:36:9 | x | line 36 |

cpp/ql/test/query-tests/Best Practices/Hiding/DeclarationHidesVariable/hiding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void structuredBinding() {
3535
int xs[1] = {1};
3636
auto [x] = xs;
3737
{
38-
auto [x] = xs; // BAD [NOT DETECTED]
38+
auto [x] = xs; // BAD
3939
auto [y] = xs; // GOOD
4040
}
4141
}

0 commit comments

Comments
 (0)