cxx-pretty-print.h (pp_cxx_cv_qualifiers): New.

* cxx-pretty-print.h (pp_cxx_cv_qualifiers): New.
	* class.c (same_signature_p): Use type_memfn_quals.
	* cp-tree.h (TYPE_RAISES_EXCEPTIONS): Use
	FUNCTION_OR_METHOD_TYPE_CHECK.
	* error.c (dump_type_suffix): Add padding before cv-qualifiers.
	* pt.c (unify): Use static_fn_type.

From-SVN: r197316
This commit is contained in:
Jason Merrill 2013-04-01 15:05:06 -04:00 committed by Jason Merrill
parent 2eed8e3701
commit c4101929ef
6 changed files with 22 additions and 26 deletions

View file

@ -1,3 +1,12 @@
2013-04-01 Jason Merrill <jason@redhat.com>
* cxx-pretty-print.h (pp_cxx_cv_qualifiers): New.
* class.c (same_signature_p): Use type_memfn_quals.
* cp-tree.h (TYPE_RAISES_EXCEPTIONS): Use
FUNCTION_OR_METHOD_TYPE_CHECK.
* error.c (dump_type_suffix): Add padding before cv-qualifiers.
* pt.c (unify): Use static_fn_type.
2013-04-01 Bronek Kozicki <b.kozicki@gmail.com>
Jason Merrill <jason@redhat.com>

View file

@ -2066,14 +2066,12 @@ same_signature_p (const_tree fndecl, const_tree base_fndecl)
&& same_type_p (DECL_CONV_FN_TYPE (fndecl),
DECL_CONV_FN_TYPE (base_fndecl))))
{
tree types, base_types;
types = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
base_types = TYPE_ARG_TYPES (TREE_TYPE (base_fndecl));
if ((cp_type_quals (TREE_TYPE (TREE_VALUE (base_types)))
== cp_type_quals (TREE_TYPE (TREE_VALUE (types))))
&& (type_memfn_rqual (TREE_TYPE (fndecl))
== type_memfn_rqual (TREE_TYPE (base_fndecl)))
&& compparms (TREE_CHAIN (base_types), TREE_CHAIN (types)))
tree fntype = TREE_TYPE (fndecl);
tree base_fntype = TREE_TYPE (base_fndecl);
if (type_memfn_quals (fntype) == type_memfn_quals (base_fntype)
&& type_memfn_rqual (fntype) == type_memfn_rqual (base_fntype)
&& compparms (FUNCTION_FIRST_USER_PARMTYPE (fndecl),
FUNCTION_FIRST_USER_PARMTYPE (base_fndecl)))
return 1;
}
return 0;

View file

@ -1888,7 +1888,8 @@ struct GTY((variable_size)) lang_type {
a deferred noexcept-specification, TREE_PURPOSE is a DEFERRED_NOEXCEPT
(for templates) or an OVERLOAD list of functions (for implicitly
declared functions). */
#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE)
#define TYPE_RAISES_EXCEPTIONS(NODE) \
TYPE_LANG_SLOT_1 (FUNCTION_OR_METHOD_TYPE_CHECK (NODE))
/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'
or noexcept(true). */

View file

@ -42,6 +42,8 @@ typedef struct
#define pp_cxx_cv_qualifier_seq(PP, T) \
pp_c_type_qualifier_list (pp_c_base (PP), T)
#define pp_cxx_cv_qualifiers(PP, CV) \
pp_c_cv_qualifiers (pp_c_base (PP), CV, false)
#define pp_cxx_whitespace(PP) pp_c_whitespace (pp_c_base (PP))
#define pp_cxx_left_paren(PP) pp_c_left_paren (pp_c_base (PP))

View file

@ -829,10 +829,8 @@ dump_type_suffix (tree t, int flags)
anyway; they may in g++, but we'll just pretend otherwise. */
dump_parameters (arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
if (TREE_CODE (t) == METHOD_TYPE)
pp_cxx_cv_qualifier_seq (cxx_pp, class_of_this_parm (t));
else
pp_cxx_cv_qualifier_seq (cxx_pp, t);
pp_base (cxx_pp)->padding = pp_before;
pp_cxx_cv_qualifiers (cxx_pp, type_memfn_quals (t));
dump_ref_qualifier (t, flags);
dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags);
dump_type_suffix (TREE_TYPE (t), flags);

View file

@ -17085,9 +17085,6 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
deduces the type of the member as a function type. */
if (TYPE_PTRMEMFUNC_P (arg))
{
tree method_type;
tree fntype;
/* Check top-level cv qualifiers */
if (!check_cv_quals_for_unify (UNIFY_ALLOW_NONE, arg, parm))
return unify_cv_qual_mismatch (explain_p, parm, arg);
@ -17097,17 +17094,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
UNIFY_ALLOW_NONE, explain_p);
/* Determine the type of the function we are unifying against. */
method_type = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (arg));
fntype =
build_function_type (TREE_TYPE (method_type),
TREE_CHAIN (TYPE_ARG_TYPES (method_type)));
tree fntype = static_fn_type (arg);
/* Extract the cv-qualifiers and ref-qualifier of the member
function from the implicit object parameter and place them
on the function type to be restored later. */
fntype = apply_memfn_quals (fntype,
type_memfn_quals (method_type),
type_memfn_rqual (method_type));
return unify (tparms, targs, TREE_TYPE (parm), fntype, strict, explain_p);
}