Skip to content

Suppress static analysis warning 26426 for Windows/MSVC builds#3057

Merged
horenmar merged 2 commits intocatchorg:develfrom
OliverBeeckAVM:p/obeeck/suppress26426
Jan 1, 2026
Merged

Suppress static analysis warning 26426 for Windows/MSVC builds#3057
horenmar merged 2 commits intocatchorg:develfrom
OliverBeeckAVM:p/obeeck/suppress26426

Conversation

@OliverBeeckAVM
Copy link
Contributor

Suppress Global initializer calls a non-constexpr function 'Catch::makeTestInvoker' (i.22)., which is issued when using macro TEST_CASE for 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 of CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS. This will disable the warning in a more targeted manner.

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
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.10%. Comparing base (88abf9b) to head (c15675d).

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@horenmar
Copy link
Member

horenmar commented Jan 1, 2026

Thanks, the change looks fine. I'll let the CI run and then merge it later.

@horenmar horenmar merged commit b7e31c9 into catchorg:devel Jan 1, 2026
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants