https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120056
--- Comment #1 from catsith at me dot com --- The source code comment is wrong; std::expected template arguments do matter - replacing int with void removes the issue. The use of function pointers isn't necessary to trigger this; also happens with std::function. std::vector<std::expected<int, bool>> also exhibits this behavior, it's just it is more surprising when using std::expected as a function parameter.