https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84537
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- I think just --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -5541,6 +5541,10 @@ bool suggest_alternative_in_explicit_scope (location_t location, tree name, tree scope) { + /* Something went very wrong; don't suggest anything. */ + if (name == error_mark_node) + return false; + /* Resolve any namespace aliases. */ scope = ORIGINAL_NAMESPACE (scope); should do.