https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94505
Bug ID: 94505
Summary: Logical operator inside fold-expression: strange
warning
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: frank.winklmeier at cern dot ch
Target Milestone: ---
This was first reported in [1] but I could not find any bug report. The
following code compiled with `gcc -Wall -std=c++17`:
template <bool... B>
bool foo () {
return ((B && true) || ...);
}
int main () {
foo<true, false, false, true> ();
}
produces this warning:
t.cxx:7:38: required from here
t.cxx:3:18: warning: suggest parentheses around '&&' within '||'
[-Wparentheses]
return ((B && true) || ...);
~~~^~~~~~~~
t.cxx:3:18: warning: suggest parentheses around '&&' within '||'
[-Wparentheses]
Reproducible with any recent gcc version including gcc-trunk-20200406 (on
godbolt).
[1]
http://gcc.1065356.n8.nabble.com/Logical-operator-inside-fold-expression-strange-warning-td1627740.html