Re: Small C++ PATCH to lookup_base

2013-03-25 Thread Jason Merrill

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.





Small C++ PATCH to lookup_base

2013-03-16 Thread Jason Merrill

This function ought to handle null T.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 5ce73161422bffd51252e639ad2da79df31438ee
Author: Jason Merrill 
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)