* decl.c (build_ptrmemfunc_type): Don't give a PMF RECORD_TYPE
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Jun 2014 18:51:22 +0000 (18:51 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Jun 2014 18:51:22 +0000 (18:51 +0000)
TYPE_BINFO or TYPE_LANG_SPECIFIC.
* cp-tree.h (TYPE_PTRMEMFUNC_FLAG): Use TYPE_LANG_FLAG_2.
(TYPE_PTRMEMFUNC_P): Don't expect TYPE_LANG_SPECIFIC.
* typeck.c (build_ptrmemfunc_access_expr): Don't use lookup_member.
* pt.c (unify): Also check whether the argument is a PMF.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212164 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/pt.c
gcc/cp/typeck.c

index bfe4da6..e925e13 100644 (file)
@@ -1,3 +1,12 @@
+2014-06-30  Jason Merrill  <jason@redhat.com>
+
+       * decl.c (build_ptrmemfunc_type): Don't give a PMF RECORD_TYPE
+       TYPE_BINFO or TYPE_LANG_SPECIFIC.
+       * cp-tree.h (TYPE_PTRMEMFUNC_FLAG): Use TYPE_LANG_FLAG_2.
+       (TYPE_PTRMEMFUNC_P): Don't expect TYPE_LANG_SPECIFIC.
+       * typeck.c (build_ptrmemfunc_access_expr): Don't use lookup_member.
+       * pt.c (unify): Also check whether the argument is a PMF.
+
 2014-06-30  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/54891
index c1bd7cf..1e9e1af 100644 (file)
@@ -126,6 +126,7 @@ c-common.h, not after.
    0: TYPE_DEPENDENT_P
    1: TYPE_HAS_USER_CONSTRUCTOR.
    2: TYPE_HAS_LATE_RETURN_TYPE (in FUNCTION_TYPE, METHOD_TYPE)
+      TYPE_PTRMEMFUNC_FLAG (in RECORD_TYPE)
    3: TYPE_FOR_JAVA.
    4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
    5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE)
@@ -3561,11 +3562,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
    function type.  */
 #define TYPE_PTRMEMFUNC_P(NODE)                \
   (TREE_CODE (NODE) == RECORD_TYPE     \
-   && TYPE_LANG_SPECIFIC (NODE)                \
    && TYPE_PTRMEMFUNC_FLAG (NODE))
 
 #define TYPE_PTRMEMFUNC_FLAG(NODE) \
-  (LANG_TYPE_CLASS_CHECK (NODE)->ptrmemfunc_flag)
+  (TYPE_LANG_FLAG_2 (RECORD_TYPE_CHECK (NODE)))
 
 /* Returns true if NODE is a pointer-to-member.  */
 #define TYPE_PTRMEM_P(NODE) \
index 6902bb0..909f762 100644 (file)
@@ -8073,13 +8073,10 @@ build_ptrmemfunc_type (tree type)
     unqualified_variant
       = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
 
-  t = make_class_type (RECORD_TYPE);
-  xref_basetypes (t, NULL_TREE);
+  t = make_node (RECORD_TYPE);
 
-  /* Let the front end know this is a pointer to member function...  */
+  /* Let the front end know this is a pointer to member function.  */
   TYPE_PTRMEMFUNC_FLAG (t) = 1;
-  /* ... and not really a class type.  */
-  SET_CLASS_TYPE_P (t, 0);
 
   field = build_decl (input_location, FIELD_DECL, pfn_identifier, type);
   fields = field;
@@ -8109,7 +8106,6 @@ build_ptrmemfunc_type (tree type)
       TYPE_MAIN_VARIANT (t) = unqualified_variant;
       TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
       TYPE_NEXT_VARIANT (unqualified_variant) = t;
-      TREE_TYPE (TYPE_BINFO (t)) = t;
     }
 
   /* Cache this pointer-to-member type so that we can find it again
index 7f33b6d..70a946c 100644 (file)
@@ -18104,6 +18104,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
                        TYPE_PTRMEMFUNC_FN_TYPE (arg),
                        strict, explain_p);
        }
+      else if (TYPE_PTRMEMFUNC_P (arg))
+       return unify_type_mismatch (explain_p, parm, arg);
 
       if (CLASSTYPE_TEMPLATE_INFO (parm))
        {
index 042e600..9758dfe 100644 (file)
@@ -2848,8 +2848,10 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
      type.  */
   ptrmem_type = TREE_TYPE (ptrmem);
   gcc_assert (TYPE_PTRMEMFUNC_P (ptrmem_type));
-  member = lookup_member (ptrmem_type, member_name, /*protect=*/0,
-                         /*want_type=*/false, tf_warning_or_error);
+  for (member = TYPE_FIELDS (ptrmem_type); member;
+       member = DECL_CHAIN (member))
+    if (DECL_NAME (member) == member_name)
+      break;
   return build_simple_component_ref (ptrmem, member);
 }