Commit 37fb0a98 by Jason Merrill Committed by Jason Merrill

semantics.c (lambda_expr_this_capture): In unevaluated context, just return the nearest 'this'.

	* semantics.c (lambda_expr_this_capture): In unevaluated context,
	just return the nearest 'this'.

From-SVN: r196550
parent 0ef811d7
2013-03-08 Jason Merrill <jason@redhat.com>
* semantics.c (lambda_expr_this_capture): In unevaluated context,
just return the nearest 'this'.
PR c++/51494
PR c++/51884
PR c++/56222
......
......@@ -9513,6 +9513,11 @@ lambda_expr_this_capture (tree lambda)
if (!this_capture)
{
/* In unevaluated context this isn't an odr-use, so just return the
nearest 'this'. */
if (cp_unevaluated_operand)
return lookup_name (this_identifier);
error ("%<this%> was not captured for this lambda function");
result = error_mark_node;
}
......
// Uses of 'this' in unevaluated context are not odr-uses.
// { dg-do compile { target c++11 } }
struct A
{
int f() {}
int i;
void foo()
{
[] () { sizeof(i); sizeof(f()); };
}
};
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