diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-08-09 18:32:02 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-08-09 18:32:02 +0000 |
commit | b9e17a4abb8eb2a41a7872fc4961ce4939312977 (patch) | |
tree | 1ff0784160f8c2d88777310405e7581704bfedb3 /gcc/cp/pt.c | |
parent | e6e4aafad9a284f6180bcd55fcfdebf3391df050 (diff) | |
download | gcc-b9e17a4abb8eb2a41a7872fc4961ce4939312977.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250994 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bd61438fc39..3d6f4b512b5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -22493,16 +22493,17 @@ always_instantiate_p (tree decl) } /* If FN has a noexcept-specifier that hasn't been instantiated yet, - instantiate it now, modifying TREE_TYPE (fn). */ + instantiate it now, modifying TREE_TYPE (fn). Returns false on + error, true otherwise. */ -void -maybe_instantiate_noexcept (tree fn) +bool +maybe_instantiate_noexcept (tree fn, tsubst_flags_t complain) { tree fntype, spec, noex, clone; /* Don't instantiate a noexcept-specification from template context. */ if (processing_template_decl) - return; + return true; if (DECL_CLONED_FUNCTION_P (fn)) fn = DECL_CLONED_FUNCTION (fn); @@ -22510,7 +22511,7 @@ maybe_instantiate_noexcept (tree fn) spec = TYPE_RAISES_EXCEPTIONS (fntype); if (!spec || !TREE_PURPOSE (spec)) - return; + return true; noex = TREE_PURPOSE (spec); @@ -22519,7 +22520,7 @@ maybe_instantiate_noexcept (tree fn) static hash_set<tree>* fns = new hash_set<tree>; bool added = false; if (DEFERRED_NOEXCEPT_PATTERN (noex) == NULL_TREE) - spec = get_defaulted_eh_spec (fn); + spec = get_defaulted_eh_spec (fn, complain); else if (!(added = !fns->add (fn))) { /* If hash_set::add returns true, the element was already there. */ @@ -22553,6 +22554,9 @@ maybe_instantiate_noexcept (tree fn) if (added) fns->remove (fn); + if (spec == error_mark_node) + return false; + TREE_TYPE (fn) = build_exception_variant (fntype, spec); } @@ -22563,6 +22567,8 @@ maybe_instantiate_noexcept (tree fn) else TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone), spec); } + + return true; } /* Produce the definition of D, a _DECL generated from a template. If |