diff options
Diffstat (limited to 'gcc/cp/class.cc')
-rw-r--r-- | gcc/cp/class.cc | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index 9a41c00..14acb9c 100644 --- a/gcc/cp/class.cc +++ b/gcc/cp/class.cc @@ -1356,7 +1356,30 @@ add_method (tree type, tree method, bool via_using) if (!compparms (parms1, parms2)) continue; - if (!equivalently_constrained (fn, method)) + tree fn_constraints = get_constraints (fn); + tree method_constraints = get_constraints (method); + + if (fn_constraints && method_constraints + && DECL_CONTEXT (fn) != type + && !processing_template_decl) + { + if (TREE_CODE (fn) == TEMPLATE_DECL) + ++processing_template_decl; + if (tree ti = CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (fn))) + fn_constraints = tsubst_constraint_info (fn_constraints, + TI_ARGS (ti), + tf_warning_or_error, + fn); + if (tree ti = CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (method))) + method_constraints = tsubst_constraint_info (method_constraints, + TI_ARGS (ti), + tf_warning_or_error, + method); + if (TREE_CODE (fn) == TEMPLATE_DECL) + --processing_template_decl; + } + + if (!equivalent_constraints (fn_constraints, method_constraints)) { if (processing_template_decl) /* We can't check satisfaction in dependent context, wait until @@ -1407,7 +1430,7 @@ add_method (tree type, tree method, bool via_using) /* If these are versions of the same function, process and move on. */ if (TREE_CODE (fn) == FUNCTION_DECL - && maybe_version_functions (method, fn, true)) + && maybe_version_functions (method, fn)) continue; if (DECL_INHERITED_CTOR (method)) @@ -7452,7 +7475,7 @@ determine_key_method (tree type) && ! DECL_DECLARED_INLINE_P (method) && ! DECL_PURE_VIRTUAL_P (method)) { - CLASSTYPE_KEY_METHOD (type) = method; + SET_CLASSTYPE_KEY_METHOD (type, method); break; } |