From: Jason Merrill Date: Mon, 1 Apr 2013 19:05:06 +0000 (-0400) Subject: cxx-pretty-print.h (pp_cxx_cv_qualifiers): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c4101929ef37bbc91668b2ba5bd22a5361448700;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 598c2a52ee9..53dbc0b43a9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2013-04-01 Jason Merrill + + * 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 Jason Merrill diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 54180a27994..6ac9a361486 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 74ea4e49b83..08a646124bf 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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). */ diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h index f1ab0e6ec78..0f7dc4a8174 100644 --- a/gcc/cp/cxx-pretty-print.h +++ b/gcc/cp/cxx-pretty-print.h @@ -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)) diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 6df8987a63f..c599b7dbc46 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d143256b455..f1f8fe2dba5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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))); - - /* 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)); + tree fntype = static_fn_type (arg); + return unify (tparms, targs, TREE_TYPE (parm), fntype, strict, explain_p); }