Commit f02296dd by Jason Merrill Committed by Jason Merrill

re PR c++/56699 (Failed for sizeof (non-static member) in lambda expression)

	PR c++/56699
	* semantics.c (maybe_resolve_dummy): Make sure that the enclosing
	class is derived from the type of the object.

From-SVN: r197069
parent b85db96a
2013-03-23 Jason Merrill <jason@redhat.com>
2013-03-25 Jason Merrill <jason@redhat.com>
PR c++/56699
* semantics.c (maybe_resolve_dummy): Make sure that the enclosing
class is derived from the type of the object.
PR c++/52014
* semantics.c (lambda_expr_this_capture): Don't capture 'this' in
......
......@@ -9565,7 +9565,8 @@ maybe_resolve_dummy (tree object)
if (type != current_class_type
&& current_class_type
&& LAMBDA_TYPE_P (current_class_type))
&& LAMBDA_TYPE_P (current_class_type)
&& DERIVED_FROM_P (type, current_nonlambda_class_type ()))
{
/* In a lambda, need to go through 'this' capture. */
tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type);
......
// PR c++/56699
// { dg-require-effective-target c++11 }
struct A
{
int a;
};
struct T
{
int x;
T() : x([]{
sizeof(::A::a);
return 0;
}())
{}
};
struct B
{
int a;
};
void f()
{
[]{sizeof(B::a);};
}
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