re PR c++/41896 ([c++0x] Segfault because of a nested lambda function)
PR c++/41896 * semantics.c (outer_lambda_capture_p): Use current_function_decl instead of current_class_type. From-SVN: r156673
This commit is contained in:
parent
f1c3cf3c93
commit
2cb95a6ade
|
@ -1,3 +1,9 @@
|
|||
2010-02-10 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/41896
|
||||
* semantics.c (outer_lambda_capture_p): Use current_function_decl
|
||||
instead of current_class_type.
|
||||
|
||||
2010-02-10 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/42983, core issue 906
|
||||
|
|
|
@ -2714,8 +2714,9 @@ outer_lambda_capture_p (tree decl)
|
|||
{
|
||||
return (TREE_CODE (decl) == FIELD_DECL
|
||||
&& LAMBDA_TYPE_P (DECL_CONTEXT (decl))
|
||||
&& (!current_class_type
|
||||
|| !DERIVED_FROM_P (DECL_CONTEXT (decl), current_class_type)));
|
||||
/* Using current_class_type here causes problems with uses in a
|
||||
nested lambda-introducer; see 41896. */
|
||||
&& DECL_CONTEXT (current_function_decl) != DECL_CONTEXT (decl));
|
||||
}
|
||||
|
||||
/* ID_EXPRESSION is a representation of parsed, but unprocessed,
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2010-02-10 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/41896
|
||||
* g++.dg/cpp0x/lambda/lambda-nested3.C: New.
|
||||
|
||||
PR c++/42983, core issue 906
|
||||
* g++.dg/cpp0x/defaulted15.C: Add virtualness test.
|
||||
* g++.dg/cpp0x/defaulted9.C: Move virtual default outside class.
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// PR c++/41896
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
void nested_lambda()
|
||||
{
|
||||
float val;
|
||||
|
||||
[val]()
|
||||
{
|
||||
[val](){};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue