public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94505] New: Logical operator inside fold-expression: strange warning
@ 2020-04-06 18:57 frank.winklmeier at cern dot ch
  2020-04-06 20:04 ` [Bug c++/94505] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: frank.winklmeier at cern dot ch @ 2020-04-06 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-20 19:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 18:57 [Bug c++/94505] New: Logical operator inside fold-expression: strange warning frank.winklmeier at cern dot ch
2020-04-06 20:04 ` [Bug c++/94505] " redi at gcc dot gnu.org
2020-04-19 15:45 ` mpolacek at gcc dot gnu.org
2020-04-20 19:35 ` cvs-commit at gcc dot gnu.org
2020-04-20 19:45 ` cvs-commit at gcc dot gnu.org
2020-04-20 19:46 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).