Minor C++ PATCH for dependent_type_p sanity check

Jason Merrill jason@redhat.com
Wed May 10 16:32:00 GMT 2017


A while back I noticed that we were calling dependent_type_p with
global_type_node, which should never happen.  I fixed that separately,
but this patch adds a check to catch it if it happens again.

Tested x86_64-pc-linux-gnu, applying to trunk.
-------------- next part --------------
commit f9b1055070c90162f505d11a929a797f55d3230f
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Feb 17 15:24:17 2017 -0500

            * pt.c (dependent_type_p): Make sure we aren't called with
            global_type_node.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 72256b3..b9e7af7 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -23436,6 +23436,10 @@ dependent_type_p (tree type)
   if (type == error_mark_node)
     return false;
 
+  /* Getting here with global_type_node means we improperly called this
+     function on the TREE_TYPE of an IDENTIFIER_NODE.  */
+  gcc_checking_assert (type != global_type_node);
+
   /* If we have not already computed the appropriate value for TYPE,
      do so now.  */
   if (!TYPE_DEPENDENT_P_VALID (type))


More information about the Gcc-patches mailing list