re PR c++/51464 ([c++0x] ICE with invalid use of [])
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 14 Dec 2011 00:36:15 +0000 (00:36 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 14 Dec 2011 00:36:15 +0000 (00:36 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice6.C [new file with mode: 0644]

index 3e7abcc0a3592dc7332d7498aebf020fc3650faf..23748d8bdd8eee27a573e8a9361e7a6a9d72a3e8 100644 (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
index ae15eb17b8d08f00cdede1c4cf9d11d01365e238..49b508ce83a07bbb41d7e9d4c81cbd9aaf8d8d71 100644 (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);
 
index 4b1ec46cb9837c1aeaa2e55ac68f6fa3c0678c18..7e1a396332c8ec1c64f77e9d5c7c7be54e817429 100644 (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;
index 7a66fa41251d8c9b010e647aab5839c6fbb89474..5011d2c10863f549a411a7f216a4e711a5e8eed3 100644 (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>
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice6.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice6.C
new file mode 100644 (file)
index 0000000..ddf3527
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/51464
+// { dg-options "-std=c++0x" }
+
+template<int = sizeof([])> struct A {}; // { dg-error "lambda" }