https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103923
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-01-06 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- The problem is actually that the auto return type can't be deduced while the enclosing class is incomplete, not that H is incomplete. N.B. You can fix your code by simply changing the return type to not use auto: struct H { int operator()(const K &) const { return 0; } }; In any case, I think changing libstdc++ to make the code ill-formed would be an improvement than silently compiling it but getting the traits wrong.