re PR c++/72800 (ICE on invalid C++14 code with initialized lambda capture: tree...
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 4 Aug 2016 19:22:58 +0000 (19:22 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 4 Aug 2016 19:22:58 +0000 (19:22 +0000)
/cp
2016-08-04  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/72800
* lambda.c (add_capture): Check lambda_capture_field_type return
value for error_mark_node.

/testsuite
2016-08-04  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/72800
* g++.dg/cpp1y/lambda-ice1.C: New.

From-SVN: r239148

gcc/cp/ChangeLog
gcc/cp/lambda.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/lambda-ice1.C [new file with mode: 0644]

index 5ec690d6e2e6993d9082c2f0e95b9c015caa8d77..c295a85bf7046ba31b3756da99c47053c41037a3 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/72800
+       * lambda.c (add_capture): Check lambda_capture_field_type return
+       value for error_mark_node.
+
 2016-08-04  Patrick Palka  <ppalka@gcc.gnu.org>
 
        PR c++/72759
index abb967a9aaec983f8f41486510d6e552e4063f40..978fa0d841f4361a56a721f353bb9b3335462f66 100644 (file)
@@ -492,6 +492,8 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,
   else
     {
       type = lambda_capture_field_type (initializer, explicit_init_p);
+      if (type == error_mark_node)
+       return error_mark_node;
       if (by_reference_p)
        {
          type = build_reference_type (type);
index c456b1886deee45a0b7d3892e2ef1b0e379c32df..5237b6a1446f6686e66f25d3c17ab69a7999f797 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/72800
+       * g++.dg/cpp1y/lambda-ice1.C: New.
+
 2016-08-04  Patrick Palka  <ppalka@gcc.gnu.org>
 
        PR c++/72759
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-ice1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-ice1.C
new file mode 100644 (file)
index 0000000..86fb88a
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/72800
+// { dg-do compile { target c++14 } }
+
+void foo ()
+{
+  [n {}] {};  // { dg-error "one element|deducing" }
+}