https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108458
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- These all work too: static_assert([]()consteval {return std::vector<int>{1, 2} == get_val(std::vector<std::vector<int>>{ {1, 2}, {3, 4}}); }()); static_assert([]()consteval {return std::vector<int>{1, 2} == get_val(consteval_get_data()); }()); static_assert([]()consteval {return std::vector<int>{1, 2} == get_val(constexpr_get_data()); }()); So I think GCC is correct because static_assert is NOT an immediate function context .