This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch c++]: Fix PR/64127 ICE on invalid: tree check: exprected identifier_node, have template_id_expr in cp_parser_diagnose_invalid_type_name
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>
- Date: Thu, 4 Dec 2014 16:12:02 +0100
- Subject: [patch c++]: Fix PR/64127 ICE on invalid: tree check: exprected identifier_node, have template_id_expr in cp_parser_diagnose_invalid_type_name
- Authentication-results: sourceware.org; auth=none
Hi,
this patch fixes an ICE happening on invalid code for < c++11. It is
reasoned by
accessing blindly identifier without checking that it is a declaration.
ChangeLog
2014-12-04 Kai Tietz <ktietz@redhat.com>
PR c++/64127
* parser.c (cp_parser_diagnose_invalid_type_name): Check
id for being a declaration before accessing identifier.
Tested on x86_64-unknown-linux-gnu.
Ok for apply?
Regards,
Kai
Index: parser.c
===================================================================
--- parser.c (Revision 218309)
+++ parser.c (Arbeitskopie)
@@ -2977,6 +2977,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *p
inform (location, "C++11 %<noexcept%> only available with "
"-std=c++11 or -std=gnu++11");
else if (cxx_dialect < cxx11
+ && DECL_P (id)
&& !strcmp (IDENTIFIER_POINTER (id), "thread_local"))
inform (location, "C++11 %<thread_local%> only available with "
"-std=c++11 or -std=gnu++11");