aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/method.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-08-09 14:32:02 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-08-09 14:32:02 -0400
commit9fb82e652cee118b5c9d77e1e60a351a37a55dc8 (patch)
tree1ff0784160f8c2d88777310405e7581704bfedb3 /gcc/cp/method.c
parent04d07b61cb80fd97e98eb39451ff6a8675a63d90 (diff)
downloadgcc-9fb82e652cee118b5c9d77e1e60a351a37a55dc8.zip
gcc-9fb82e652cee118b5c9d77e1e60a351a37a55dc8.tar.gz
gcc-9fb82e652cee118b5c9d77e1e60a351a37a55dc8.tar.bz2
PR c++/81359 - Unparsed NSDMI error from SFINAE context.
* init.c (get_nsdmi): Add complain parm. * typeck2.c (digest_nsdmi_init): Add complain parm. (process_init_constructor_record): Pass complain to get_nsdmi. * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool. * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into synthesized_method_walk. (synthesized_method_walk): Adjust. (walk_field_subobs): Pass complain to get_nsdmi. (defaulted_late_check): Skip other checks if deleted. * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept. * call.c (build_aggr_conv): Pass complain to get_nsdmi. * parser.c (defarg_location): New. * error.c (location_of): Use it. From-SVN: r250994
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r--gcc/cp/method.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 8b07f52..bff9605 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1357,7 +1357,7 @@ walk_field_subobs (tree fields, tree fnname, special_function_kind sfk,
default constructor is noexcept(false). */
if (spec_p)
{
- tree nsdmi = get_nsdmi (field, /*ctor*/false);
+ tree nsdmi = get_nsdmi (field, /*ctor*/false, complain);
if (!expr_noexcept_p (nsdmi, complain))
*spec_p = noexcept_false_spec;
}
@@ -1660,6 +1660,10 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
flags |= LOOKUP_DEFAULTED;
tsubst_flags_t complain = diag ? tf_warning_or_error : tf_none;
+ if (diag && spec_p)
+ /* We're in get_defaulted_eh_spec; we don't actually want any walking
+ diagnostics, we just want complain set. */
+ diag = false;
int quals = const_p ? TYPE_QUAL_CONST : TYPE_UNQUALIFIED;
for (binfo = TYPE_BINFO (ctype), i = 0;
@@ -1749,7 +1753,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
needed. Return what it should be. */
tree
-get_defaulted_eh_spec (tree decl)
+get_defaulted_eh_spec (tree decl, tsubst_flags_t complain)
{
if (DECL_CLONED_FUNCTION_P (decl))
decl = DECL_CLONED_FUNCTION (decl);
@@ -1759,8 +1763,9 @@ get_defaulted_eh_spec (tree decl)
tree parm_type = TREE_VALUE (parms);
bool const_p = CP_TYPE_CONST_P (non_reference (parm_type));
tree spec = empty_except_spec;
+ bool diag = !DECL_DELETED_FN (decl) && (complain & tf_error);
synthesized_method_walk (ctype, sfk, const_p, &spec, NULL, NULL,
- NULL, false, DECL_INHERITED_CTOR (decl),
+ NULL, diag, DECL_INHERITED_CTOR (decl),
parms);
return spec;
}
@@ -2173,6 +2178,12 @@ defaulted_late_check (tree fn)
"does not match expected signature %qD", implicit_fn);
}
+ if (DECL_DELETED_FN (implicit_fn))
+ {
+ DECL_DELETED_FN (fn) = 1;
+ return;
+ }
+
/* 8.4.2/2: An explicitly-defaulted function (...) may have an explicit
exception-specification only if it is compatible (15.4) with the
exception-specification on the implicit declaration. If a function
@@ -2231,9 +2242,6 @@ defaulted_late_check (tree fn)
}
DECL_DECLARED_CONSTEXPR_P (fn) = false;
}
-
- if (DECL_DELETED_FN (implicit_fn))
- DECL_DELETED_FN (fn) = 1;
}
/* OK, we've parsed the NSDMI for class T, now we can check any explicit