aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/method.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-02-19 21:00:29 -0500
committerJason Merrill <jason@gcc.gnu.org>2019-02-19 21:00:29 -0500
commit9d35a27a8353b57ed11fa1cb7d747edf1c4faa01 (patch)
treedd8f6590bbce03b4e8b1c01a6fae5791f01696f6 /gcc/cp/method.c
parent8dca1dc386b4b87558ed80b12a3d700908baeac0 (diff)
downloadgcc-9d35a27a8353b57ed11fa1cb7d747edf1c4faa01.zip
gcc-9d35a27a8353b57ed11fa1cb7d747edf1c4faa01.tar.gz
gcc-9d35a27a8353b57ed11fa1cb7d747edf1c4faa01.tar.bz2
PR c++/88368 - wrong 'use of deleted function'
Since my patch for 81359 allowed us to signal failure on return from maybe_instantiate_noexcept, we no longer need to turn an error into noexcept(false). We also need to handle NSDMI instantiation errors under synthesized_method_walk. This change caused some instantiation context notes to be lost in the testsuite, so I added push_tinst_level to get_defaulted_eh_spec to restore that context. * method.c (walk_field_subobs): Remember errors from get_nsdmi. (get_defaulted_eh_spec): Call push_tinst_level. * pt.c (maybe_instantiate_noexcept): Keep error_mark_node. * typeck2.c (merge_exception_specifiers): Handle error_mark_node. From-SVN: r269032
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r--gcc/cp/method.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index a5f2304..6e0df68 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1367,7 +1367,10 @@ walk_field_subobs (tree fields, special_function_kind sfk, tree fnname,
if (spec_p)
{
tree nsdmi = get_nsdmi (field, /*ctor*/false, complain);
- if (!expr_noexcept_p (nsdmi, complain))
+ if (nsdmi == error_mark_node)
+ *spec_p = error_mark_node;
+ else if (*spec_p != error_mark_node
+ && !expr_noexcept_p (nsdmi, complain))
*spec_p = noexcept_false_spec;
}
/* Don't do the normal processing. */
@@ -1753,8 +1756,13 @@ get_defaulted_eh_spec (tree decl, tsubst_flags_t complain)
if (SFK_DTOR_P (sfk) && DECL_VIRTUAL_P (decl))
/* We have to examine virtual bases even if abstract. */
sfk = sfk_virtual_destructor;
+ bool pushed = false;
+ if (CLASSTYPE_TEMPLATE_INSTANTIATION (ctype))
+ pushed = push_tinst_level (decl);
synthesized_method_walk (ctype, sfk, const_p, &spec, NULL, NULL,
NULL, diag, &inh, parms);
+ if (pushed)
+ pop_tinst_level ();
return spec;
}