diff options
author | Jason Merrill <jason@redhat.com> | 2017-10-10 14:04:02 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-10-10 14:04:02 -0400 |
commit | 84dd815ff8765c61376a352863d8482a72f79b37 (patch) | |
tree | a1d29341c64d9d46baace208102db49665b10367 /gcc/cp/pt.c | |
parent | e1bea3412a75a300c3866dcf9559c2b796f5b430 (diff) | |
download | gcc-84dd815ff8765c61376a352863d8482a72f79b37.zip gcc-84dd815ff8765c61376a352863d8482a72f79b37.tar.gz gcc-84dd815ff8765c61376a352863d8482a72f79b37.tar.bz2 |
More delayed lambda capture fixes.
* call.c (add_function_candidate): Use build_address.
(build_op_call_1): Call mark_lvalue_use early.
(build_over_call): Handle error from build_this.
* constexpr.c (cxx_bind_parameters_in_call): Use build_address.
(cxx_eval_increment_expression): Don't use rvalue().
* cvt.c (convert_to_void): Use mark_discarded_use.
* expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR. Fix
reference handling. Don't copy the expression.
(mark_discarded_use): New.
* lambda.c (insert_capture_proxy): Add some sanity checking.
(maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
* pt.c (register_local_specialization): Add sanity check.
* semantics.c (process_outer_var_ref): Fix check for existing proxy.
* typeck.c (cp_build_addr_expr_1): Handle error from
mark_lvalue_use.
(cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
from rvalue.
Handle generic lambda capture in dependent expressions.
* lambda.c (need_generic_capture, dependent_capture_r)
(do_dependent_capture): New.
* pt.c (processing_nonlambda_template): Use need_generic_capture.
* semantics.c (maybe_cleanup_point_expr)
(maybe_cleanup_point_expr_void, finish_goto_stmt)
(maybe_convert_cond): Call do_dependent_capture.
* typeck.c (build_static_cast): Remove dependent capture handling.
From-SVN: r253601
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d93d518..ba52f3b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1895,6 +1895,7 @@ reregister_specialization (tree spec, tree tinfo, tree new_spec) void register_local_specialization (tree spec, tree tmpl) { + gcc_assert (tmpl != spec); local_specializations->put (tmpl, spec); } @@ -9494,30 +9495,14 @@ in_template_function (void) return ret; } -/* Returns true iff we are currently within a template other than a generic - lambda. We test this by finding the outermost closure type and checking - whether it is dependent. */ +/* Returns true iff we are currently within a template other than a + default-capturing generic lambda, so we don't need to worry about semantic + processing. */ bool processing_nonlambda_template (void) { - if (!processing_template_decl) - return false; - - tree outer_closure = NULL_TREE; - for (tree t = current_class_type; t; - t = decl_type_context (TYPE_MAIN_DECL (t))) - { - if (LAMBDA_TYPE_P (t)) - outer_closure = t; - else - break; - } - - if (outer_closure) - return dependent_type_p (outer_closure); - else - return true; + return processing_template_decl && !need_generic_capture (); } /* Returns true if T depends on any template parameter with level LEVEL. */ |