Hi! On Thu, Mar 14, 2024 at 04:58:41PM +0000, Jonathan Wakely wrote: > Add the [[nodiscard]] attribute to several functions in <algorithm>.
r14-9478 added [[nodiscard]] to various <algorithm> APIs including find_if the pr104601.C testcase uses. As it is an optimization bug fix testcase, haven't tried to adjust the testcase to use the find_if result, but instead have added -Wno-unused-result flag to quiet the warning. The testcase tests side-effects of the lambda used by find_if rather than its actual result. Tested on x86_64-linux -m32/-m64, committed to trunk as obvious. 2024-03-15 Jakub Jelinek <ja...@redhat.com> * g++.dg/torture/pr104601.C: Add -Wno-unused-result to dg-options. --- gcc/testsuite/g++.dg/torture/pr104601.C.jj 2022-05-23 21:44:48.390854093 +0200 +++ gcc/testsuite/g++.dg/torture/pr104601.C 2024-03-15 09:59:08.581824938 +0100 @@ -1,6 +1,6 @@ // PR tree-optimization/104601 // { dg-do run } -// { dg-options "-std=c++17" } +// { dg-options "-std=c++17 -Wno-unused-result" } #include <algorithm> #include <optional> Jakub