On 05/13/2016 03:17 PM, Jason Merrill wrote:
On 02/16/2016 07:49 PM, Jason Merrill wrote:
Clearly the DR 141 change is requiring much larger adjustments in the
rest of the compiler than I'm comfortable making at this point in the
GCC 6 schedule, so I'm backing out my earlier changes for 10200 and
69753 and replacing them with a more modest fix for 10200: Now we will
still find member function templates by unqualified lookup, we just
won't find namespace-scope function templates.  The earlier approach
will return in GCC 7 stage 1.

As promised.  The prerequisite for the DR 141 change was fixing the
C++11 handling of type-dependence of member access expressions,
including calls.  14.6.2.2 says,

A class member access expression (5.2.5) is type-dependent if the
expression refers to a member of the current instantiation and the type
of the referenced member is dependent, or the class member access
expression refers to a member of an unknown specialization. [ Note: In
an expression of the form x.y or xp->y the type of the expression is
usually the type of the member y of the class of x (or the class pointed
to by xp). However, if x or xp refers to a dependent type that is not
the current instantiation, the type of y is always dependent. If x or xp
refers to a non-dependent type or refers to the current instantiation,
the type of y is the type of the class member access expression. —end
note ]

Previously we had been treating such expressions as type-dependent if
the object-expression is type-dependent, even if its type is the current
instantiation.  Fixing this required a few changes in other areas that
now have to deal with non-dependent member function calls within a
template.

A small tweak to handling of value-dependent functions to better match the text of the standard.


commit 9a4d77c31e361644e4deffb6a6e21a87948b0ac0
Author: Jason Merrill <ja...@redhat.com>
Date:   Mon May 16 15:52:25 2016 -0400

    	* pt.c (value_dependent_expression_p): Tweak new cases to better
    	match the wording in the standard.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 65bfd42..fde3091 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -22649,19 +22649,14 @@ value_dependent_expression_p (tree expression)
   switch (TREE_CODE (expression))
     {
     case BASELINK:
-      /* A member function of a dependent class has dependent template
-	 arguments from its class.  */
-      if (dependent_type_p (BINFO_TYPE (BASELINK_BINFO (expression))))
-	return true;
-      return value_dependent_expression_p (BASELINK_FUNCTIONS (expression));
+      /* A dependent member function of the current instantiation.  */
+      return dependent_type_p (BINFO_TYPE (BASELINK_BINFO (expression)));
 
     case FUNCTION_DECL:
-      /* A function template specialization is value-dependent if it has any
-	 dependent template arguments, since that means it cannot be
-	 instantiated for constexpr evaluation.  */
-      if (DECL_LANG_SPECIFIC (expression)
-	  && DECL_TEMPLATE_INFO (expression))
-	return any_dependent_template_arguments_p (DECL_TI_ARGS (expression));
+      /* A dependent member function of the current instantiation.  */
+      if (DECL_CLASS_SCOPE_P (expression)
+	  && dependent_type_p (DECL_CONTEXT (expression)))
+	return true;
       break;
 
     case IDENTIFIER_NODE:

Reply via email to