]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/51043 - ICE in LTO
authorDodji Seketeli <dodji@redhat.com>
Wed, 9 Nov 2011 19:25:01 +0000 (19:25 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Wed, 9 Nov 2011 19:25:01 +0000 (20:25 +0100)
* cp-tree.h (TYPE_ALIAS_P, TYPE_TEMPLATE_INFO): Don't crash on
NULL TYPE_NAME.

From-SVN: r181231

gcc/cp/ChangeLog
gcc/cp/cp-tree.h

index 9c5a2bcc142f4b3eb5601b4bfb466cecaa6b7b2d..a545511f79ef65fca9bcce981691b7cd0890c126 100644 (file)
 
 2011-11-09  Dodji Seketeli  <dodji@redhat.com>
 
+       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.
index 5ba18856d16b4336654d9b90407c855d3253115d..b306976c62c9e4a9eed214b7c9941c51a22e3b76 100644 (file)
@@ -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