Skip to content

Commit 6e6b94a

Browse files
jketemaCopilot
andcommitted
Use global initializer in pack regression
Exercise the empty and non-empty pack calls from a global initializer rather than main, and use generic names for the helper and pack. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c33e0fd commit 6e6b94a

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

‎cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticVariables/UnusedStaticVariables.expected‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
| test.cpp:8:12:8:21 | staticVar6 | Static variable staticVar6 is never read. |
33
| test.cpp:10:11:10:19 | constVar8 | Static variable constVar8 is never read. |
44
| test.cpp:12:12:12:22 | staticVar10 | Static variable staticVar10 is never read. |
5-
| test.cpp:53:25:53:39 | restrictionPack | Static variable restrictionPack is never read. |
5+
| test.cpp:53:25:53:30 | values | Static variable values is never read. |

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,9 @@ struct WithDestructor
5050
static WithConstructor constructed; // GOOD (constructor has a side effect)
5151
static WithDestructor destructed; // GOOD (destructor has a side effect)
5252

53-
static auto All(auto... restrictionPack) // $ SPURIOUS: Alert
53+
static auto sum(auto... values) // $ SPURIOUS: Alert
5454
{
55-
return (0U + ... + static_cast<unsigned>(restrictionPack));
55+
return (0U + ... + static_cast<unsigned>(values));
5656
}
5757

58-
int main()
59-
{
60-
return All() + All(2U);
61-
}
58+
unsigned result = sum() + sum(2U);

0 commit comments

Comments
 (0)