On Mon, Mar 24, 2014 at 02:02:27PM -0400, Jason Merrill wrote:
> On 03/18/2014 11:16 AM, Jakub Jelinek wrote:
> >Jason, do you have better ideas how to fix this?
> 
> Better would be to return false from potential_constant_expression_1
> for DECL_EXPR; just add another case to the various _STMT tree
> codes.

Thanks, here is what I've checked in after another bootstrap/regtest:

2014-03-25  Jakub Jelinek  <ja...@redhat.com>

        PR c++/60331
        * semantics.c (potential_constant_expression_1): Handle
        DECL_EXPR.

        * testsuite/libgomp.c++/udr-11.C: New test.
        * testsuite/libgomp.c++/udr-12.C: New test.
        * testsuite/libgomp.c++/udr-13.C: New test.
        * testsuite/libgomp.c++/udr-14.C: New test.
        * testsuite/libgomp.c++/udr-15.C: New test.
        * testsuite/libgomp.c++/udr-16.C: New test.
        * testsuite/libgomp.c++/udr-17.C: New test.
        * testsuite/libgomp.c++/udr-18.C: New test.
        * testsuite/libgomp.c++/udr-19.C: New test.

--- gcc/cp/semantics.c.jj       2014-03-13 19:01:19.000000000 +0100
+++ gcc/cp/semantics.c  2014-03-24 20:51:24.912546906 +0100
@@ -10253,6 +10253,7 @@ potential_constant_expression_1 (tree t,
     case DO_STMT:
     case FOR_STMT:
     case WHILE_STMT:
+    case DECL_EXPR:
       if (flags & tf_error)
         error ("expression %qE is not a constant-expression", t);
       return false;
--- libgomp/testsuite/libgomp.c++/udr-11.C.jj   2014-03-18 11:47:43.326846415 
+0100
+++ libgomp/testsuite/libgomp.c++/udr-11.C      2014-03-18 11:47:43.329846576 
+0100
@@ -0,0 +1,4 @@
+// { dg-do run }
+// { dg-options "-fopenmp -std=c++11" }
+
+#include "udr-1.C"
--- libgomp/testsuite/libgomp.c++/udr-12.C.jj   2014-03-18 11:47:43.330846623 
+0100
+++ libgomp/testsuite/libgomp.c++/udr-12.C      2014-03-18 11:47:43.331846666 
+0100
@@ -0,0 +1,4 @@
+// { dg-do run }
+// { dg-options "-fopenmp -std=c++11" }
+
+#include "udr-2.C"
--- libgomp/testsuite/libgomp.c++/udr-13.C.jj   2014-03-18 11:47:43.332846707 
+0100
+++ libgomp/testsuite/libgomp.c++/udr-13.C      2014-03-18 11:47:43.332846707 
+0100
@@ -0,0 +1,4 @@
+// { dg-do run }
+// { dg-options "-fopenmp -std=c++11" }
+
+#include "udr-3.C"
--- libgomp/testsuite/libgomp.c++/udr-14.C.jj   2014-03-18 11:47:43.333846744 
+0100
+++ libgomp/testsuite/libgomp.c++/udr-14.C      2014-03-18 11:47:43.334846777 
+0100
@@ -0,0 +1,4 @@
+// { dg-do run }
+// { dg-options "-fopenmp -std=c++11" }
+
+#include "udr-4.C"
--- libgomp/testsuite/libgomp.c++/udr-15.C.jj   2014-03-18 11:47:43.334846777 
+0100
+++ libgomp/testsuite/libgomp.c++/udr-15.C      2014-03-18 11:47:43.335846809 
+0100
@@ -0,0 +1,4 @@
+// { dg-do run }
+// { dg-options "-fopenmp -std=c++11" }
+
+#include "udr-5.C"
--- libgomp/testsuite/libgomp.c++/udr-16.C.jj   2014-03-18 11:47:43.336846840 
+0100
+++ libgomp/testsuite/libgomp.c++/udr-16.C      2014-03-18 11:47:43.336846840 
+0100
@@ -0,0 +1,4 @@
+// { dg-do run }
+// { dg-options "-fopenmp -std=c++11" }
+
+#include "udr-6.C"
--- libgomp/testsuite/libgomp.c++/udr-17.C.jj   2014-03-18 11:47:43.337846867 
+0100
+++ libgomp/testsuite/libgomp.c++/udr-17.C      2014-03-18 11:47:43.337846867 
+0100
@@ -0,0 +1,4 @@
+// { dg-do run }
+// { dg-options "-fopenmp -std=c++11" }
+
+#include "udr-7.C"
--- libgomp/testsuite/libgomp.c++/udr-18.C.jj   2014-03-18 11:47:43.338846892 
+0100
+++ libgomp/testsuite/libgomp.c++/udr-18.C      2014-03-18 11:47:43.338846892 
+0100
@@ -0,0 +1,4 @@
+// { dg-do run }
+// { dg-options "-fopenmp -std=c++11" }
+
+#include "udr-8.C"
--- libgomp/testsuite/libgomp.c++/udr-19.C.jj   2014-03-18 11:47:43.339846916 
+0100
+++ libgomp/testsuite/libgomp.c++/udr-19.C      2014-03-18 11:47:43.339846916 
+0100
@@ -0,0 +1,4 @@
+// { dg-do run }
+// { dg-options "-fopenmp -std=c++11" }
+
+#include "udr-9.C"


        Jakub

Reply via email to