This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77927] unary right fold fails to compile
- From: "jeff.mirwaisi at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 11 Oct 2016 00:53:50 +0000
- Subject: [Bug c++/77927] unary right fold fails to compile
- Auto-submitted: auto-generated
- References: <bug-77927-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77927
--- Comment #3 from Jeff Mirwaisi <jeff.mirwaisi at gmail dot com> ---
Apologies for the poor bug report, to clarify, unary right folds which use a
binary
operator in the fold parameter are failing to compile:
( (x op1 y) op2... );
//clearer examples - error: binary expression in operand of fold-expression
template<int...N> void f1(){ ((N+1)+...); }
template<int...N> void f2(){ ((1+N),...); }
template<int...N> void f3(){ ((N-1)*...); }
//op1 and op2 do not have to be the same operator
//the corresponding left folds compile as expected:
template<int...N> void f4(){ (...+(1+N)); }