Commit eb086562 by Paolo Carlini Committed by Paolo Carlini

re PR c++/71570 (ICE on invalid variable capture in…

re PR c++/71570 (ICE on invalid variable capture in cxx_incomplete_type_diagnostic, at cp/typeck2.c:55)

/cp
2017-07-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71570
	* lambda.c (add_capture): Early return if we cannot capture by
	reference.

/testsuite
2017-07-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71570
	* g++.dg/cpp0x/lambda/lambda-ice17.C: New.

From-SVN: r250591
parent 7e2a8417
2017-07-26 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71570
* lambda.c (add_capture): Early return if we cannot capture by
reference.
2017-07-26 Jason Merrill <jason@redhat.com> 2017-07-26 Jason Merrill <jason@redhat.com>
P0702R1 - List deduction of vector. P0702R1 - List deduction of vector.
......
...@@ -529,7 +529,10 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p, ...@@ -529,7 +529,10 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,
else if (id != this_identifier && by_reference_p) else if (id != this_identifier && by_reference_p)
{ {
if (!lvalue_p (initializer)) if (!lvalue_p (initializer))
error ("cannot capture %qE by reference", initializer); {
error ("cannot capture %qE by reference", initializer);
return error_mark_node;
}
} }
else else
{ {
......
2017-07-26 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71570
* g++.dg/cpp0x/lambda/lambda-ice17.C: New.
2017-07-26 H.J. Lu <hongjiu.lu@intel.com> 2017-07-26 H.J. Lu <hongjiu.lu@intel.com>
PR target/81563 PR target/81563
......
// PR c++/71570
// { dg-do compile { target c++11 } }
void foo (int);
void foo (void)
{
[&foo] // { dg-error "cannot capture" }
{
foo (0);
};
}
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