diff mbox

Small C++ PATCH to lookup_base

Message ID 51451E18.3000709@redhat.com
State New
Headers show

Commit Message

Jason Merrill March 17, 2013, 1:36 a.m. UTC
This function ought to handle null T.

Tested x86_64-pc-linux-gnu, applying to trunk.

Comments

Jason Merrill March 25, 2013, 8:55 p.m. UTC | #1
On 03/16/2013 09:36 PM, Jason Merrill wrote:
> This function ought to handle null T.

I didn't think any of my other patches required this, but apparently I 
was wrong; this fixes 56692, so I'm applying it to 4.8 as well.
diff mbox

Patch

commit 5ce73161422bffd51252e639ad2da79df31438ee
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Mar 5 12:38:34 2013 -0500

    	* search.c (lookup_base): Handle NULL_TREE.

diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 4cc02ba..54a5e4a 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -188,6 +188,14 @@  lookup_base (tree t, tree base, base_access access,
   tree t_binfo;
   base_kind bk;
 
+  /* "Nothing" is definitely not derived from Base.  */
+  if (t == NULL_TREE)
+    {
+      if (kind_ptr)
+	*kind_ptr = bk_not_base;
+      return NULL_TREE;
+    }
+
   if (t == error_mark_node || base == error_mark_node)
     {
       if (kind_ptr)