C++ PATCH for c++/48594 (failure with overloaded ->* in template)

Message ID 4DAF9E63.6050701@redhat.com
State New
Headers show

Commit Message

Jason Merrill April 21, 2011, 3:02 a.m.
While backporting this to 4.5 and 4.4 I noticed that making the object 
non-dependent shouldn't be conditionalized.

Tested x86_64-pc-linux-gnu, applying to 4.6 and trunk.  Applying the two 
patches folded together on 4.4 and 4.5.
commit a39f5c2859bb16af16945830f3c0802c40441b70
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 20 12:48:33 2011 -0700

    	PR c++/48594
    	* decl2.c (build_offset_ref_call_from_tree): Move
    	non-dependency of object outside condition.


diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 1217e42..89e03c0 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4079,9 +4079,9 @@  build_offset_ref_call_from_tree (tree fn, VEC(tree,gc) **args)
 	 parameter.  That must be done before the FN is transformed
 	 because we depend on the form of FN.  */
       make_args_non_dependent (*args);
+      object = build_non_dependent_expr (object);
       if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
-	  object = build_non_dependent_expr (object);
 	  if (TREE_CODE (fn) == DOTSTAR_EXPR)
 	    object = cp_build_addr_expr (object, tf_warning_or_error);
 	  VEC_safe_insert (tree, gc, *args, 0, object);