re PR c++/51464 ([c++0x] ICE with invalid use of [])

/cp
2011-12-13  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51464
	* semantics.c (begin_lambda_type): Check begin_class_definition return
	value for error_mark_node.
	* parser.c (cp_parser_lambda_expression): Check begin_lambda_type
	return value for error_mark_node.

/testsuite
2011-12-13  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51464
	* g++.dg/cpp0x/lambda/lambda-ice6.C: New.

From-SVN: r182320
This commit is contained in:
Paolo Carlini 2011-12-14 00:36:15 +00:00 committed by Paolo Carlini
parent 639166b250
commit 6fdc547369
5 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2011-12-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51464
* semantics.c (begin_lambda_type): Check begin_class_definition return
value for error_mark_node.
* parser.c (cp_parser_lambda_expression): Check begin_lambda_type
return value for error_mark_node.
2011-12-13 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/14258

View File

@ -8033,6 +8033,8 @@ cp_parser_lambda_expression (cp_parser* parser)
cp_parser_lambda_introducer (parser, lambda_expr);
type = begin_lambda_type (lambda_expr);
if (type == error_mark_node)
return error_mark_node;
record_lambda_scope (lambda_expr);

View File

@ -8623,6 +8623,8 @@ begin_lambda_type (tree lambda)
/* Start the class. */
type = begin_class_definition (type, /*attributes=*/NULL_TREE);
if (type == error_mark_node)
return error_mark_node;
/* Cross-reference the expression and the type. */
LAMBDA_EXPR_CLOSURE (lambda) = type;

View File

@ -1,3 +1,8 @@
2011-12-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51464
* g++.dg/cpp0x/lambda/lambda-ice6.C: New.
2011-12-13 Andrew Pinski <apinski@cavium.com>
Adam Nemet <anemet@caviumnetworks.com>

View File

@ -0,0 +1,4 @@
// PR c++/51464
// { dg-options "-std=c++0x" }
template<int = sizeof([])> struct A {}; // { dg-error "lambda" }