C++: Fix DeclarationHidesVariable FP

We don't want alerts about the compiler-generated variables that appear
in the desugaring of range-based `for`.
This commit is contained in:
Jonas Jensen
2019-07-05 20:36:16 +02:00
parent 443a8fbc07
commit 8d3cb78a9d
3 changed files with 3 additions and 4 deletions

View File

@@ -1,5 +1,2 @@
| 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:30:5:30:5 | (__begin) | Variable (__begin) hides another variable of the same name (on $@). | hiding.cpp:29:3:29:3 | (__begin) | line 29 |
| hiding.cpp:30:5:30:5 | (__end) | Variable (__end) hides another variable of the same name (on $@). | hiding.cpp:29:3:29:3 | (__end) | line 29 |
| hiding.cpp:30:5:30:5 | (__range) | Variable (__range) hides another variable of the same name (on $@). | hiding.cpp:29:3:29:3 | (__range) | line 29 |

View File

@@ -27,6 +27,6 @@ namespace foo {
void nestedRangeBasedFor() {
int xs[4], ys[4];
for (auto x : xs)
for (auto y : ys) // GOOD [FALSE POSITIVE]
for (auto y : ys) // GOOD
x = y = 0;
}