This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77927] unary right fold fails to compile


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)); }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]