mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Add test for structured binding declaration hiding variable
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
| 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 |
|
||||
| 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 |
|
||||
| hiding.cpp:38:10:38:10 | (unnamed local variable) | Variable (unnamed local variable) hides another variable of the same name (on $@). | hiding.cpp:36:8:36:8 | (unnamed local variable) | line 36 |
|
||||
| hiding.cpp:39:10:39:10 | (unnamed local variable) | Variable (unnamed local variable) hides another variable of the same name (on $@). | hiding.cpp:36:8:36:8 | (unnamed local variable) | line 36 |
|
||||
|
||||
@@ -30,3 +30,12 @@ void nestedRangeBasedFor() {
|
||||
for (auto y : ys) // GOOD
|
||||
x = y = 0;
|
||||
}
|
||||
|
||||
void structuredBinding() {
|
||||
int xs[1] = {1};
|
||||
auto [x] = xs;
|
||||
{
|
||||
auto [x] = xs; // BAD
|
||||
auto [y] = xs; // GOOD [FALSE POSITIVE]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user