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]

[C++ Patch] PR 56534


Hi,

this (and 55786, which is a Dup) is an ICE on invalid regression in 4.7/4.8. The problem is that for such broken input, check_elaborated_type_specifier is called by cp_parser_elaborated_type_specifier with a DECL which has a nul TREE_TYPE, a TEMPLATE_ID_EXPR actually, and therefore immediately crashes on TREE_CODE (type) == TEMPLATE_TYPE_PARM.

In comparison, 4_6-branch, instead of calling check_elaborated_type_specifier, has cp_parser_elaborated_type_specifier simply doing type = TREE_TYPE (decl), thus it seems we can cure the regression in a straightforward and safe way by simply checking that TREE_TYPE (decl) is not nul at the beginning of check_elaborated_type_specifier. In this way the error messages are also exactly the same produced by 4_6.

Tested x86_64-linux.

Thanks,
Paolo.

//////////////////////

Attachment: CL_56534
Description: Text document

Attachment: patch_56534
Description: Text document


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