aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/class.c14
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/cxx-pretty-print.h2
-rw-r--r--gcc/cp/error.c6
-rw-r--r--gcc/cp/pt.c16
6 files changed, 23 insertions, 27 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 598c2a5..53dbc0b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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>
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 54180a2..6ac9a361 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 74ea4e4..08a6461 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 f1ab0e6..0f7dc4a 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 6df8987..c599b7d 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 d143256..f1f8fe2 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);
}