https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93951
--- Comment #2 from Guillaume Morin <guillaume at morinfr dot org> --- fwiw the reproducer can be reduced further to: #include <variant> struct S1 { bool fct() const; }; struct V { bool visit() const { auto visitor = [](auto&& s) -> bool { return s.fct(); }; return std::visit(visitor, v); } std::variant<S1> v; };