From 70701817172b98bee680e34f40e69f4c96ed613f Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Wed, 29 Oct 2025 09:50:29 -0600 Subject: [PATCH] :bug: Don't capture in STATIC_ASSERT macro Problem; - All the arguments to `STATIC_ASSERT` are `constexpr` and must not be captured in the `STATIC_ASSERT` lambda. Solution: - Remove capture clauses. --- include/stdx/static_assert.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/stdx/static_assert.hpp b/include/stdx/static_assert.hpp index 5fe2c14..7f3be39 100644 --- a/include/stdx/static_assert.hpp +++ b/include/stdx/static_assert.hpp @@ -31,7 +31,7 @@ template constexpr auto ct_check = ct_check_t{}; // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define STATIC_ASSERT(cond, ...) \ - [&]() -> bool { \ + []() -> bool { \ STDX_PRAGMA(diagnostic push) \ STDX_PRAGMA(diagnostic ignored "-Wunknown-warning-option") \ STDX_PRAGMA(diagnostic ignored "-Wc++26-extensions") \ @@ -45,7 +45,7 @@ template constexpr auto ct_check = ct_check_t{}; // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define STATIC_ASSERT(cond, ...) \ - [&]() -> bool { \ + []() -> bool { \ constexpr auto S = STDX_CT_FORMAT(__VA_ARGS__); \ stdx::detail::ct_check.template emit(); \ return B; \