re PR c++/60250 ([c++1y] ICE using lambda for array size)

PR c++/60250
	* parser.c (cp_parser_direct_declarator): Don't wrap a
	type-dependent expression in a NOP_EXPR.

From-SVN: r207996
This commit is contained in:
Jason Merrill 2014-02-21 09:01:29 -05:00 committed by Jason Merrill
parent e429bc3555
commit 9e01a71f1a
3 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2014-02-21 Jason Merrill <jason@redhat.com>
PR c++/60250
* parser.c (cp_parser_direct_declarator): Don't wrap a
type-dependent expression in a NOP_EXPR.
PR c++/60251
* lambda.c (is_normal_capture_proxy): Handle VLA capture.

View File

@ -17233,7 +17233,8 @@ cp_parser_direct_declarator (cp_parser* parser,
"array bound is not an integer constant");
bounds = error_mark_node;
}
else if (processing_template_decl)
else if (processing_template_decl
&& !type_dependent_expression_p (bounds))
{
/* Remember this wasn't a constant-expression. */
bounds = build_nop (TREE_TYPE (bounds), bounds);

View File

@ -0,0 +1,7 @@
// PR c++/60250
// { dg-options "-std=c++1y -pedantic-errors" }
template<typename> void foo()
{
typedef int T[ ([](){ return 1; }()) ]; // { dg-error "runtime bound" }
}