re PR c++/84664 (internal compiler error: in cp_perform_integral_promotions, at cp...
authorMarek Polacek <polacek@redhat.com>
Fri, 2 Mar 2018 17:55:28 +0000 (17:55 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 2 Mar 2018 17:55:28 +0000 (17:55 +0000)
PR c++/84664
* typeck.c (cp_perform_integral_promotions): Check the result of
mark_rvalue_use.

* g++.dg/cpp0x/lambda/lambda-ice28.C: New test.

From-SVN: r258149

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

index 29287c8d0bbbcd862a21d0175080aba61a5bdd80..112e13a967264b8832d55c74811728bfceed57e5 100644 (file)
@@ -3,6 +3,10 @@
        PR c++/84663
        * decl.c (cp_complete_array_type): Check error_mark_node.
 
+       PR c++/84664
+       * typeck.c (cp_perform_integral_promotions): Check the result of
+       mark_rvalue_use.
+
 2018-03-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/84662
index 0e7c63dd197354fe07c9ca0b86fd05c20ae10ac2..f535902231d5ccdfa9dbb19674d6fbdf056e1430 100644 (file)
@@ -2161,6 +2161,8 @@ cp_perform_integral_promotions (tree expr, tsubst_flags_t complain)
   tree promoted_type;
 
   expr = mark_rvalue_use (expr);
+  if (error_operand_p (expr))
+    return error_mark_node;
 
   /* [conv.prom]
 
index 42160721e0e826a241b0febe82e0362039361386..670d388b88459247f79411a5ce2eb5535eaaed4e 100644 (file)
@@ -6,6 +6,9 @@
        PR c++/84663
        * g++.dg/parse/array-size3.C: New test.
 
+       PR c++/84664
+       * g++.dg/cpp0x/lambda/lambda-ice28.C: New test.
+
 2018-03-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/84662
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice28.C
new file mode 100644 (file)
index 0000000..5fe3212
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/84664
+// { dg-do compile { target c++11 } }
+
+void
+foo ()
+{
+  auto &b = 1; // { dg-error "cannot bind" }
+  [] { b > 0; }; // { dg-error ".b. is not captured" }
+}