Suppress static analysis warning 26426 for Windows/MSVC builds#3057
Merged
horenmar merged 2 commits intocatchorg:develfrom Jan 1, 2026
Merged
Suppress static analysis warning 26426 for Windows/MSVC builds#3057horenmar merged 2 commits intocatchorg:develfrom
horenmar merged 2 commits intocatchorg:develfrom
Conversation
Suppress `Global initializer calls a non-constexpr function 'Catch::makeTestInvoker' (i.22).`, which is issued when using macro `TEST_CASE` for windows/MSVC builds.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #3057 +/- ##
=======================================
Coverage 91.10% 91.10%
=======================================
Files 202 202
Lines 8750 8750
=======================================
Hits 7971 7971
Misses 779 779 🚀 New features to boost your workflow:
|
horenmar
reviewed
Jan 1, 2026
Member
|
Thanks, the change looks fine. I'll let the CI run and then merge it later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Suppress
Global initializer calls a non-constexpr function 'Catch::makeTestInvoker' (i.22)., which is issued when using macroTEST_CASEfor windows/MSVC builds.Description
After switching from Catch v2 to v3, we received the following warning when using the “TEST_CASE” macro under Windows with VS 2022:
Global initializer calls a non-constexpr function ‘Catch::makeTestInvoker’ (i.22).This is a static analysis that implements the C++ Core Guidelines rule
I.22: Avoid complex initialization of global objects.With my limited knowledge of Catch2, I don't feel confident making a change to
Catch::makeTestInvoker, so I suggest using the existing mechanism ofCATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS. This will disable the warning in a more targeted manner.