https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95455
--- Comment #3 from Avi Kivity <a...@cloudius-systems.com> --- Here's a valid version (which gcc accepts): void f() { int foo = 4; auto lambda = [bar = foo] {}; static_assert(requires (decltype(lambda) x) { x; }); }