From 5cc66776c46dedbda21a89d5422663feb4a7cc45 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Wed, 9 Nov 2011 19:25:01 +0000 Subject: [PATCH] PR c++/51043 - ICE in LTO * cp-tree.h (TYPE_ALIAS_P, TYPE_TEMPLATE_INFO): Don't crash on NULL TYPE_NAME. From-SVN: r181231 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/cp-tree.h | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9c5a2bcc142f..a545511f79ef 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -41,6 +41,10 @@ 2011-11-09 Dodji Seketeli + PR c++/51043 + * cp-tree.h (TYPE_ALIAS_P, TYPE_TEMPLATE_INFO): Don't crash on + NULL TYPE_NAME. + PR c++/51027 * parser.c (cp_parser_alias_declaration): Require ';' at the end of the declaration. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 5ba18856d16b..b306976c62c9 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2550,8 +2550,9 @@ extern void decl_shadowed_for_var_insert (tree, tree); /* Nonzero for a type which is an alias for another type; i.e, a type which declaration was written 'using name-of-type = another-type'. */ -#define TYPE_ALIAS_P(NODE) \ - (TYPE_P (NODE) \ +#define TYPE_ALIAS_P(NODE) \ + (TYPE_P (NODE) \ + && TYPE_NAME (NODE) \ && TYPE_DECL_ALIAS_P (TYPE_NAME (NODE))) /* For a class type: if this structure has many fields, we'll sort them @@ -2605,15 +2606,15 @@ extern void decl_shadowed_for_var_insert (tree, tree); ->template_info) /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */ -#define TYPE_TEMPLATE_INFO(NODE) \ - (TREE_CODE (NODE) == ENUMERAL_TYPE \ - ? ENUM_TEMPLATE_INFO (NODE) : \ - (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \ - ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \ - ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE)) \ - ? CLASSTYPE_TEMPLATE_INFO (NODE) \ - : (DECL_LANG_SPECIFIC (TYPE_NAME (NODE)) \ - ? (DECL_TEMPLATE_INFO (TYPE_NAME (NODE))) \ +#define TYPE_TEMPLATE_INFO(NODE) \ + (TREE_CODE (NODE) == ENUMERAL_TYPE \ + ? ENUM_TEMPLATE_INFO (NODE) : \ + (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \ + ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \ + ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE)) \ + ? CLASSTYPE_TEMPLATE_INFO (NODE) \ + : ((TYPE_NAME (NODE) && DECL_LANG_SPECIFIC (TYPE_NAME (NODE))) \ + ? (DECL_TEMPLATE_INFO (TYPE_NAME (NODE))) \ : NULL_TREE)))) /* Set the template information for an ENUMERAL_, RECORD_, or