Commit 1d7e2ec7 by Jason Merrill Committed by Jason Merrill

decl.c (build_ptrmemfunc_type): Don't give a PMF RECORD_TYPE TYPE_BINFO or TYPE_LANG_SPECIFIC.

	* 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.

From-SVN: r212164
parent 17adeaa7
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> 2014-06-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54891 PR c++/54891
......
...@@ -126,6 +126,7 @@ c-common.h, not after. ...@@ -126,6 +126,7 @@ c-common.h, not after.
0: TYPE_DEPENDENT_P 0: TYPE_DEPENDENT_P
1: TYPE_HAS_USER_CONSTRUCTOR. 1: TYPE_HAS_USER_CONSTRUCTOR.
2: TYPE_HAS_LATE_RETURN_TYPE (in FUNCTION_TYPE, METHOD_TYPE) 2: TYPE_HAS_LATE_RETURN_TYPE (in FUNCTION_TYPE, METHOD_TYPE)
TYPE_PTRMEMFUNC_FLAG (in RECORD_TYPE)
3: TYPE_FOR_JAVA. 3: TYPE_FOR_JAVA.
4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE) 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) ...@@ -3561,11 +3562,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
function type. */ function type. */
#define TYPE_PTRMEMFUNC_P(NODE) \ #define TYPE_PTRMEMFUNC_P(NODE) \
(TREE_CODE (NODE) == RECORD_TYPE \ (TREE_CODE (NODE) == RECORD_TYPE \
&& TYPE_LANG_SPECIFIC (NODE) \
&& TYPE_PTRMEMFUNC_FLAG (NODE)) && TYPE_PTRMEMFUNC_FLAG (NODE))
#define 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. */ /* Returns true if NODE is a pointer-to-member. */
#define TYPE_PTRMEM_P(NODE) \ #define TYPE_PTRMEM_P(NODE) \
......
...@@ -8073,13 +8073,10 @@ build_ptrmemfunc_type (tree type) ...@@ -8073,13 +8073,10 @@ build_ptrmemfunc_type (tree type)
unqualified_variant unqualified_variant
= build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type)); = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
t = make_class_type (RECORD_TYPE); t = make_node (RECORD_TYPE);
xref_basetypes (t, NULL_TREE);
/* 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; 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); field = build_decl (input_location, FIELD_DECL, pfn_identifier, type);
fields = field; fields = field;
...@@ -8109,7 +8106,6 @@ build_ptrmemfunc_type (tree type) ...@@ -8109,7 +8106,6 @@ build_ptrmemfunc_type (tree type)
TYPE_MAIN_VARIANT (t) = unqualified_variant; TYPE_MAIN_VARIANT (t) = unqualified_variant;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant); TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
TYPE_NEXT_VARIANT (unqualified_variant) = t; 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 /* Cache this pointer-to-member type so that we can find it again
......
...@@ -18104,6 +18104,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, ...@@ -18104,6 +18104,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
TYPE_PTRMEMFUNC_FN_TYPE (arg), TYPE_PTRMEMFUNC_FN_TYPE (arg),
strict, explain_p); strict, explain_p);
} }
else if (TYPE_PTRMEMFUNC_P (arg))
return unify_type_mismatch (explain_p, parm, arg);
if (CLASSTYPE_TEMPLATE_INFO (parm)) if (CLASSTYPE_TEMPLATE_INFO (parm))
{ {
......
...@@ -2848,8 +2848,10 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name) ...@@ -2848,8 +2848,10 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
type. */ type. */
ptrmem_type = TREE_TYPE (ptrmem); ptrmem_type = TREE_TYPE (ptrmem);
gcc_assert (TYPE_PTRMEMFUNC_P (ptrmem_type)); gcc_assert (TYPE_PTRMEMFUNC_P (ptrmem_type));
member = lookup_member (ptrmem_type, member_name, /*protect=*/0, for (member = TYPE_FIELDS (ptrmem_type); member;
/*want_type=*/false, tf_warning_or_error); member = DECL_CHAIN (member))
if (DECL_NAME (member) == member_name)
break;
return build_simple_component_ref (ptrmem, member); return build_simple_component_ref (ptrmem, member);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment