Commit ab5f26bb by Jason Merrill Committed by Jason Merrill

PR c++/84520 - ICE with generic lambda in NSDMI.

	* lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
	'this' in a generic lambda instantiation.

From-SVN: r258021
parent d36a19c7
2018-02-26 Jason Merrill <jason@redhat.com>
PR c++/84520 - ICE with generic lambda in NSDMI.
* lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
'this' in a generic lambda instantiation.
PR c++/84559 - ICE with constexpr VLA.
* constexpr.c (ensure_literal_type_for_constexpr_object): Check
for constexpr variable with VLA type.
......
......@@ -758,11 +758,14 @@ lambda_expr_this_capture (tree lambda, bool add_capture_p)
lambda_stack);
if (LAMBDA_EXPR_EXTRA_SCOPE (tlambda)
&& !COMPLETE_TYPE_P (LAMBDA_EXPR_CLOSURE (tlambda))
&& TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (tlambda)) == FIELD_DECL)
{
/* In an NSDMI, we don't have a function to look up the decl in,
but the fake 'this' pointer that we're using for parsing is
in scope_chain. */
in scope_chain. But if the closure is already complete, we're
in an instantiation of a generic lambda, and the fake 'this'
is gone. */
init = scope_chain->x_current_class_ptr;
gcc_checking_assert
(init && (TREE_TYPE (TREE_TYPE (init))
......
// PR c++/84520
// { dg-do compile { target c++14 } }
struct A
{
static void foo(int);
void (*f)(int) = [](auto i) { foo(i); };
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment