re PR c++/58596 ([c++11] ICE with decltype in non-static data member initializer)

/cp
2013-10-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58596
	* lambda.c (lambda_expr_this_capture): Handle NSDMIs in the
	cp_unevaluated_operand case.

/testsuite
2013-10-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58596
	* g++.dg/cpp0x/lambda/lambda-nsdmi5.C: New

From-SVN: r203780
This commit is contained in:
Paolo Carlini 2013-10-17 16:58:45 +00:00 committed by Paolo Carlini
parent f541a48127
commit 206b48e4e7
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2013-10-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58596
* lambda.c (lambda_expr_this_capture): Handle NSDMIs in the
cp_unevaluated_operand case.
2013-10-16 Jason Merrill <jason@redhat.com>
* pt.c (apply_late_template_attributes): Use

View File

@ -628,7 +628,14 @@ lambda_expr_this_capture (tree lambda)
/* In unevaluated context this isn't an odr-use, so just return the
nearest 'this'. */
if (cp_unevaluated_operand)
return lookup_name (this_identifier);
{
/* In an NSDMI the fake 'this' pointer that we're using for
parsing is in scope_chain. */
if (LAMBDA_EXPR_EXTRA_SCOPE (lambda)
&& TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (lambda)) == FIELD_DECL)
return scope_chain->x_current_class_ptr;
return lookup_name (this_identifier);
}
/* Try to default capture 'this' if we can. */
if (!this_capture

View File

@ -1,3 +1,8 @@
2013-10-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58596
* g++.dg/cpp0x/lambda/lambda-nsdmi5.C: New
2013-10-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/c-output-template.c: New testcase.

View File

@ -0,0 +1,7 @@
// PR c++/58596
// { dg-do compile { target c++11 } }
struct A
{
int i = [] { return decltype(i)(); }();
};