https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95984
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-06-29 CC| |jason at gcc dot gnu.org, | |mpolacek at gcc dot gnu.org Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- If I'm reading the dump right the front end constructs a lambda object and calls its member operator() with a null this pointer: ;; Function static decltype (((const callback<main()::<lambda(int)> >::<lambda(auto:1 ...)>*)0)->operator()<auto:1 ...>(static_cast<auto:1&&>(callback::._anon_2::_FUN::<unnamed>) ...)) callback<main()::<lambda(int)> >::<lambda(auto:1 ...)>::_FUN(auto:1 ...) [with auto:1 = {int}; decltype (((const callback<main()::<lambda(int)> >::<lambda(auto:1 ...)>*)0)->operator()<auto:1 ...>(static_cast<auto:1&&>(callback::._anon_2::_FUN::<unnamed>) ...)) = void] (null) ;; enabled by -tree-original <<cleanup_point <<< Unknown tree: expr_stmt callback<main()::<lambda(int)> >::<lambda(auto:1 ...)>::operator()<int> (0B, D.2439) >>>>>; return; So it seems like the warning code is doing what it's supposed to. The ICE is triggered by the C++ front end printing the instantiation context (print_instantiation_full_context), the pretty printer formatting the template specialization, calling into the C++ front end to perform type substitution, and the FE ending up calling check_nonnull_arg() on the call, which ends up triggering the warning and re-entering the diagnostic machinery. There is nothing out of the ordinary the warning does to do this so it must be a latent problem in the C++ front end that the warning exposed. I expect Jason or Marek have seen and deal with something like this before.