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
* [Bug c++/94505] Logical operator inside fold-expression: strange warning 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 ` redi at gcc dot gnu.org 2020-04-19 15:45 ` mpolacek at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: redi at gcc dot gnu.org @ 2020-04-06 20:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94505 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-04-06 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Keywords| |diagnostic ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94505] Logical operator inside fold-expression: strange warning 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 ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: mpolacek at gcc dot gnu.org @ 2020-04-19 15:45 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94505 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org CC| |mpolacek at gcc dot gnu.org ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94505] Logical operator inside fold-expression: strange warning 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 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2020-04-20 19:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94505 --- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:5bdd4c5d3fc9c143e8edea3b10828e4b75d7a385 commit r10-7830-g5bdd4c5d3fc9c143e8edea3b10828e4b75d7a385 Author: Marek Polacek <polacek@redhat.com> Date: Sun Apr 19 12:12:01 2020 -0400 c++: Fix bogus -Wparentheses warning with fold-expression [PR94505] We issue bogus -Wparentheses warnings (3 of them!) for this fold expression: ((B && true) || ...) Firstly, issuing a warning for a compiler-generated expression is wrong and secondly, B && true must be wrapped in ( ) otherwise you'll get error: binary expression in operand of fold-expression. PR c++/94505 - bogus -Wparentheses warning with fold-expression. * pt.c (fold_expression): Add warning_sentinel for -Wparentheses before calling build_x_binary_op. * g++.dg/cpp1z/fold11.C: New test. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94505] Logical operator inside fold-expression: strange warning 2020-04-06 18:57 [Bug c++/94505] New: Logical operator inside fold-expression: strange warning frank.winklmeier at cern dot ch ` (2 preceding siblings ...) 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 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2020-04-20 19:45 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94505 --- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-9 branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:83eeda5f004c3b9cbeccd3da1c3fe58b3015e55f commit r9-8518-g83eeda5f004c3b9cbeccd3da1c3fe58b3015e55f Author: Marek Polacek <polacek@redhat.com> Date: Mon Apr 20 15:43:49 2020 -0400 c++: Fix bogus -Wparentheses warning with fold-expression [PR94505] We issue bogus -Wparentheses warnings (3 of them!) for this fold expression: ((B && true) || ...) Firstly, issuing a warning for a compiler-generated expression is wrong and secondly, B && true must be wrapped in ( ) otherwise you'll get error: binary expression in operand of fold-expression. PR c++/94505 - bogus -Wparentheses warning with fold-expression. * pt.c (fold_expression): Add warning_sentinel for -Wparentheses before calling build_x_binary_op. * g++.dg/cpp1z/fold11.C: New test. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94505] Logical operator inside fold-expression: strange warning 2020-04-06 18:57 [Bug c++/94505] New: Logical operator inside fold-expression: strange warning frank.winklmeier at cern dot ch ` (3 preceding siblings ...) 2020-04-20 19:45 ` cvs-commit at gcc dot gnu.org @ 2020-04-20 19:46 ` mpolacek at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: mpolacek at gcc dot gnu.org @ 2020-04-20 19:46 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94505 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Fixed in GCC 9.4 and 10. ^ 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).