Skip to content

Commit 0ecfb5e

Browse files
jketemaCopilot
andcommitted
Mark side-effecting iterator dereference as a good case
Treat the unused range-for variable as intentionally unreported because its initializer may have side effects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 24f492b commit 0ecfb5e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedLocals

‎cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedLocals/code2.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void test_range_based_for()
105105
output(v1);
106106
}
107107

108-
for (int v2 : myContainer) // $ MISSING: Alert // BAD: v2 is not used (iterator dereference may have side effects)
108+
for (int v2 : myContainer) // GOOD: iterator dereference may have side effects
109109
{
110110
}
111111
}

0 commit comments

Comments
 (0)