https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118230
Harald van Dijk <harald at gigawatt dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #1 from Harald van Dijk <harald at gigawatt dot nl> --- The error is because the static_assert is evaluated while the class is still being defined. This becomes clearer with a tweaked example: #include <utility> #include <type_traits> #include <functional> struct A { struct B { auto operator()(const auto& i) const /* -> std::size_t */ { return std::hash<int>{}(i); } }; decltype(B()(123)) x; static_assert( std::is_invocable_v<const B&, const int&> ); // FAILED!!! }; int main() { A{}; } Here, line 10 results in: error: use of 'auto A::B::operator()(const auto:6&) const [with auto:6 = int]' before deduction of 'auto' But std::is_invocable_v is tricky, it cannot report this error, it can only give true or false.