This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix C++/38638 ICE superfluous 'typename'


Hi,
  The problem here is that the parser was not checking if we were in
typename mode that we either got back a TYPE_DECL or a
TEMPLATE_ID_EXPR.  This would either allow the code (in much older
versions of GCC) or cause an ICE when seeing if the type is a const
type or not as the type would be an "unknown type".  This fixes the
problem by adding in the case if we don't have a TYPE_DECL or a
TEMPLATE_ID_EXPR, set the type to NULL so we will error out about this
not being a type later on.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* parser.c (cp_parser_elaborated_type_specifier): If we have a
typename tag and don't have either a TYPE_DECL or a TEMPLATE_ID_EXPR,
set the type to NULL.

* g++.dg/template/typename15.C: New testcase.
* g++.dg/template/typename16.C: New testcase.

Attachment: fix38638.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]