From 4856a1f0a1b91d2917ab09b08c55ff4fbf66f94e Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 16 Oct 2015 07:06:11 +0000 Subject: [PATCH] re PR c++/67926 (Using folding expressions in a constexpr context ice's) /cp 2015-10-16 Paolo Carlini 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 PR c++/67926 * g++.dg/cpp1z/fold-ice1.C: New. From-SVN: r228861 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/constexpr.c | 4 ++++ gcc/testsuite/ChangeLog | 7 ++++++- gcc/testsuite/g++.dg/cpp1z/fold-ice1.C | 8 ++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/fold-ice1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b5951afbee4..6664cf939d4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2015-10-16 Paolo Carlini + + 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 Aldy Hernandez diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index ec9710cfbdf..1bb8efa90ed 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fa4fb7da29a..7d8b89fb19c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,7 +1,12 @@ +2015-10-16 Paolo Carlini + + PR c++/67926 + * g++.dg/cpp1z/fold-ice1.C: New. + 2015-10-16 Michael Collison Andrew Pinski - * testsuite/gcc.dg/tree-ssa/minmax-loopend.c: New test. + * gcc.dg/tree-ssa/minmax-loopend.c: New test. 2015-10-15 Marek Polacek diff --git a/gcc/testsuite/g++.dg/cpp1z/fold-ice1.C b/gcc/testsuite/g++.dg/cpp1z/fold-ice1.C new file mode 100644 index 00000000000..558f5893b05 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/fold-ice1.C @@ -0,0 +1,8 @@ +// PR c++/67926 +// { dg-options -std=c++1z } + +template bool FUR = (T && ...); +template bool FUL = (... && T); + +template bool FBR = (T1 && ... && T2); +template bool FBL = (T2 && ... && T1); -- 2.30.2