re PR c++/67926 (Using folding expressions in a constexpr context ice's)
authorPaolo Carlini <paolo@gcc.gnu.org>
Fri, 16 Oct 2015 07:06:11 +0000 (07:06 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 16 Oct 2015 07:06:11 +0000 (07:06 +0000)
/cp
2015-10-16  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/67926
* constexpr.c (potential_constant_expression_1): Handle
UNARY_LEFT_FOLD_EXPR, UNARY_RIGHT_FOLD_EXPR, BINARY_LEFT_FOLD_EXPR,
BINARY_RIGHT_FOLD_EXPR.

/testsuite
2015-10-16  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/67926
* g++.dg/cpp1z/fold-ice1.C: New.

From-SVN: r228861

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

index b5951afbee49e4d94cc4c19302e185f9f8d3a319..6664cf939d4cbccb689eeacc6baaface9cded926 100644 (file)
@@ -1,3 +1,10 @@
+2015-10-16  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/67926
+       * constexpr.c (potential_constant_expression_1): Handle
+       UNARY_LEFT_FOLD_EXPR, UNARY_RIGHT_FOLD_EXPR, BINARY_LEFT_FOLD_EXPR,
+       BINARY_RIGHT_FOLD_EXPR.
+
 2015-10-13  Jakub Jelinek  <jakub@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
 
index ec9710cfbdfcc41558560a4573fb846eb94735ea..1bb8efa90ed22529005942089be5dc36efc56013 100644 (file)
@@ -4385,6 +4385,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
     case TRUTH_NOT_EXPR:
     case FIXED_CONVERT_EXPR:
     case UNARY_PLUS_EXPR:
+    case UNARY_LEFT_FOLD_EXPR:
+    case UNARY_RIGHT_FOLD_EXPR:
     unary:
       return RECUR (TREE_OPERAND (t, 0), rval);
 
@@ -4565,6 +4567,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
     case MEMBER_REF:
     case DOTSTAR_EXPR:
     case MEM_REF:
+    case BINARY_LEFT_FOLD_EXPR:
+    case BINARY_RIGHT_FOLD_EXPR:
     binary:
       for (i = 0; i < 2; ++i)
        if (!RECUR (TREE_OPERAND (t, i), want_rval))
index fa4fb7da29aa57f1825fd409a4d7f6bb9fd4692e..7d8b89fb19cb4bc863db1046d156f4b9fca464d7 100644 (file)
@@ -1,7 +1,12 @@
+2015-10-16  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/67926
+       * g++.dg/cpp1z/fold-ice1.C: New.
+
 2015-10-16  Michael Collison  <michael.collison@linaro.org>
            Andrew Pinski <andrew.pinski@caviumnetworks.com>
 
-       * testsuite/gcc.dg/tree-ssa/minmax-loopend.c: New test.
+       * gcc.dg/tree-ssa/minmax-loopend.c: New test.
 
 2015-10-15  Marek Polacek  <polacek@redhat.com>
 
diff --git a/gcc/testsuite/g++.dg/cpp1z/fold-ice1.C b/gcc/testsuite/g++.dg/cpp1z/fold-ice1.C
new file mode 100644 (file)
index 0000000..558f589
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/67926
+// { dg-options -std=c++1z }
+
+template <bool ... T> bool FUR = (T && ...);
+template <bool ... T> bool FUL = (... && T);
+
+template <bool T1, bool ... T2> bool FBR = (T1 && ... && T2);
+template <bool T1, bool ... T2> bool FBL = (T2 && ... && T1);