name-lookup.c (binding_to_template_parms_of_scope_p): Clean up.
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 2 Mar 2012 15:39:55 +0000 (15:39 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 2 Mar 2012 15:39:55 +0000 (15:39 +0000)
2012-03-02  Paolo Carlini  <paolo.carlini@oracle.com>

* name-lookup.c (binding_to_template_parms_of_scope_p): Clean up.

From-SVN: r184792

gcc/cp/ChangeLog
gcc/cp/name-lookup.c

index 6a92eeba555e2df80a3660c64f1d90c979c5d7d2..1749cc134c7ebb7c6cde55cf3228ce234cf1b0b6 100644 (file)
@@ -1,3 +1,7 @@
+2012-03-02  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * name-lookup.c (binding_to_template_parms_of_scope_p): Clean up.
+
 2012-02-29  Jason Merrill  <jason@redhat.com>
 
        PR c++/51930
index 235134249acfc2dbec4dd943b39c95dae4292d4d..e85d603d22f203e31618500caa2f95f415ee6ea5 100644 (file)
@@ -4467,20 +4467,17 @@ binding_to_template_parms_of_scope_p (cxx_binding *binding,
                                      cp_binding_level *scope)
 {
   tree binding_value;
+  tree tinfo;
 
-  if (!binding || !scope)
+  if (!binding || !scope || !scope->this_entity)
     return false;
 
   binding_value = binding->value ?  binding->value : binding->type;
+  tinfo = get_template_info (scope->this_entity);
 
-  return (scope
-         && scope->this_entity
-         && get_template_info (scope->this_entity)
-         && PRIMARY_TEMPLATE_P (TI_TEMPLATE
-                                (get_template_info (scope->this_entity)))
-         && parameter_of_template_p (binding_value,
-                                     TI_TEMPLATE (get_template_info \
-                                                   (scope->this_entity))));
+  return (tinfo
+         && PRIMARY_TEMPLATE_P (TI_TEMPLATE (tinfo))
+         && parameter_of_template_p (binding_value, TI_TEMPLATE (tinfo)));
 }
 
 /* Return the innermost non-namespace binding for NAME from a scope