https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100381
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- The code is definitely invalid. Your code instantiates std::function<void(CallParameter)> where CallParameter is IndexGroupsAndNames which is an incomplete type. Constructing a std::function checks that the callable argument is invocable with the argument types in the std::function's call signature, which is void(CallParameter). That is done using std::is_invocable_r. The spec for std::is_invocable_r<R, Fn, ArgTypes...> has this requirement: "Fn, R, and all types in the template parameter pack ArgTypes shall be complete types, cv void, or arrays of unknown bound." So you're trying to construct std::function<void(IncompleteType)> which needs to check if you can call a function with an argument of type IncompleteType, which cannot be determined because the type might be non-copyable. Using std::function<void(const CallParameter&)> would work, so would ensuring the type is complete before trying to use it in a std::function call signature.