https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99803
--- Comment #2 from CVS Commits ---
The master branch has been updated by Marek Polacek :
https://gcc.gnu.org/g:70f2bff43aadd2fcc0595bf9f4bab72647529655
commit r11-8220-g70f2bff43aadd2fcc0595bf9f4bab72647529655
Author: Marek Polacek
Date: Wed Apr 14 17:57:15 2021 -0400
c++: ICE with bogus late return type [PR99803]
Here we ICE when compiling this code in C++20, because we're trying to
slam a 'typename' after the ->. The cp_parser_template_id call just
before the spot I'm changing parsed A::template A as a BASELINK
that contains a constructor, but make_typename_type crashes on that.
This patch makes make_typename_type more robust instead of checking
for is_overloaded_fn prior calling it.
gcc/cp/ChangeLog:
PR c++/99803
* decl.c (make_typename_type): Give an error and return when
name is is_overloaded_fn.
* parser.c (cp_parser_class_name): Don't check is_overloaded_fn
before calling make_typename_type.
gcc/testsuite/ChangeLog:
PR c++/99803
* g++.dg/cpp2a/typename14.C: Don't expect particular error
messages.
* g++.dg/cpp2a/typename19.C: New test.