tree.c (bound_pmf_p): New fn.
authorJason Merrill <jason@yorick.cygnus.com>
Mon, 4 Jan 1999 11:55:37 +0000 (11:55 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 4 Jan 1999 11:55:37 +0000 (06:55 -0500)
* tree.c (bound_pmf_p): New fn.
* typeck.c (build_c_cast): Use it.

From-SVN: r24481

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/cp/typeck.c

index 372104326a47259214ec05ae10ed52bc517b050b..d120ab58967fd9ed91736b5a3cbc56f51b4ed093 100644 (file)
@@ -1,5 +1,8 @@
 1999-01-04  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * tree.c (bound_pmf_p): New fn.
+       * typeck.c (build_c_cast): Use it.
+
        * decl.c (grok_op_properties): Use same_type_p.
 
 Tue Dec 22 15:09:25 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
index 8777a1194123516826067a32c79b99aa2be5263f..b5b73cb631fe4300331b269c162d9e6782807066 100644 (file)
@@ -1338,6 +1338,17 @@ get_first_fn (from)
   return OVL_CURRENT (from);
 }
 
+/* Returns nonzero if T is a ->* or .* expression that refers to a
+   member function.  */
+
+int
+bound_pmf_p (t)
+     tree t;
+{
+  return (TREE_CODE (t) == OFFSET_REF
+         && TYPE_PTRMEMFUNC_P (TREE_TYPE (TREE_OPERAND (t, 1))));
+}
+
 /* Return a new OVL node, concatenating it with the old one. */
 
 tree
index f9c2057e24989cc9a1b2f3acc1b98a2093d3f980..b0b3be9311ca142ed0aca1c3923c46079cb7439c 100644 (file)
@@ -5630,10 +5630,9 @@ build_c_cast (type, expr)
     {
       if (TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE
          || (TREE_CODE (TREE_TYPE (value)) == METHOD_TYPE
-             /* Don't do the default conversion if we want a
-                pointer to a function.  */
+             /* Don't do the default conversion on a ->* expression.  */
              && ! (TREE_CODE (type) == POINTER_TYPE
-                   && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE))
+                   && bound_pmf_p (value)))
          || TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE
          || TREE_CODE (TREE_TYPE (value)) == REFERENCE_TYPE)
        value = default_conversion (value);