re PR c++/56710 (Using reserved double underscore variable name in a lambda causes internal compiler error)

PR c++/56710
	* semantics.c (finish_member_declaration): Don't push closure
	members.

From-SVN: r197211
This commit is contained in:
Jason Merrill 2013-03-28 14:20:45 -04:00 committed by Jason Merrill
parent c561e95201
commit fad882c6d9
3 changed files with 17 additions and 2 deletions

View file

@ -1,5 +1,9 @@
2013-03-28 Jason Merrill <jason@redhat.com>
PR c++/56710
* semantics.c (finish_member_declaration): Don't push closure
members.
* name-lookup.c (pushdecl_maybe_friend_1): Use
nonlambda_method_basetype and current_nonlambda_class_type.

View file

@ -2719,8 +2719,10 @@ finish_member_declaration (tree decl)
/*friend_p=*/0);
}
}
/* Enter the DECL into the scope of the class. */
else if (pushdecl_class_level (decl))
/* Enter the DECL into the scope of the class, if the class
isn't a closure (whose fields are supposed to be unnamed). */
else if (CLASSTYPE_LAMBDA_EXPR (current_class_type)
|| pushdecl_class_level (decl))
{
if (TREE_CODE (decl) == USING_DECL)
{

View file

@ -0,0 +1,9 @@
// PR c++/56710
// { dg-options "-std=c++11 -Wall" }
int main()
{
int t = 0;
return [&]() -> int {int __t; __t = t; return __t; }();
return [&t]() -> int {int __t; __t = t; return __t; }();
}