https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105810
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Specifically, the suggested implementation is: template<typename __glibcxxassertiontype> [[noreturn,__gnu__::__cold__,__gnu__::__noinline__]] inline void __my_glibcxx_constexpr_assert() noexcept { constexpr __glibcxxassertiontype __assertinfo; __glibcxx_assert_fail(__assertinfo.__glibcxx_assertion_file,__assertinfo.__glibcxx_assertion_line, __assertinfo.__glibcxx_pretty_function,__assertinfo.__glibcxx_assertion_condition); } #define my_glibcxx_assert(_Condition) \ { \ if (!bool(_Condition))[[unlikely]] \ { \ \ constexpr char const* __glibcxx_pretty_function_impl = __PRETTY_FUNCTION__;\ struct __glibcxxassertion{\ char const* __glibcxx_assertion_file=__FILE__;\ int __glibcxx_assertion_line=__LINE__;\ char const* __glibcxx_pretty_function="";\ char const* __glibcxx_assertion_condition=#_Condition;\ };\ __my_glibcxx_constexpr_assert<__glibcxxassertion>(); \ }\ } This instantiates a new instance of __my_glibcxx_constexpr_assert<T> with a new T for every assertion, but the actual call to __glibcxx_assert_fail is in a cold function instead of inlined into the assertion.