https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97841
Bug ID: 97841 Summary: [C++17] is_invocable handling of incomplete return type is wrong Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: jason at gcc dot gnu.org Target Milestone: --- I already mentioned this to Jonathan directly, but thought I should probably also put it in bugzilla. is_invocable and invoke_result condition their result on whether "The expression INVOKE(declval<Fn>(),declval<ArgTypes>()...) is well-formed when treated as an unevaluated operand" It seems that we currently test for this by checking whether decltype of the above is well-formed, but that seems wrong to me, since decltype of a call of incomplete type is well-formed, but that call in any other unevaluated context is ill-formed. So we accept this testcase, but VC++ and clang/libc++ reject it: #include <type_traits> struct A; using fn = A(*)(int); static_assert (std::is_invocable_v<fn,int>); // error, A is incomplete Various other places in the library talk about an expression being "well-formed when treated as an unevaluated operand" and could probably use a check to make sure they don't have the same problem. I imagine that changing decltype(INVOKE(...)) to decltype(0,INVOKE(...)) in various places would be a simple fix?