public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/111410] New: Bogus Wdangling-reference warning with ranges pipe expression in for loop @ 2023-09-14 1:09 hewillk at gmail dot com 2024-01-18 22:10 ` [Bug c++/111410] " mpolacek at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: hewillk at gmail dot com @ 2023-09-14 1:09 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111410 Bug ID: 111410 Summary: Bogus Wdangling-reference warning with ranges pipe expression in for loop Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hewillk at gmail dot com Target Milestone: --- #include <iostream> #include <vector> #include <ranges> int main() { std::vector v{1, 2, 3, 4, 5}; for (auto i : std::span{v} | std::views::take(1)) std::cout << i << '\n'; } GCC-trunk reports the following warning when the -Wall flag is used: <source>:8:51: warning: possibly dangling reference to a temporary [-Wdangling-reference] 8 | for ( auto i : std::span{v} | std::views::take(1)) | ^ https://godbolt.org/z/5jhnTTej9 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/111410] Bogus Wdangling-reference warning with ranges pipe expression in for loop 2023-09-14 1:09 [Bug c++/111410] New: Bogus Wdangling-reference warning with ranges pipe expression in for loop hewillk at gmail dot com @ 2024-01-18 22:10 ` mpolacek at gcc dot gnu.org 2024-01-18 22:53 ` mpolacek at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: mpolacek at gcc dot gnu.org @ 2024-01-18 22:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111410 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-01-18 CC| |mpolacek at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/111410] Bogus Wdangling-reference warning with ranges pipe expression in for loop 2023-09-14 1:09 [Bug c++/111410] New: Bogus Wdangling-reference warning with ranges pipe expression in for loop hewillk at gmail dot com 2024-01-18 22:10 ` [Bug c++/111410] " mpolacek at gcc dot gnu.org @ 2024-01-18 22:53 ` mpolacek at gcc dot gnu.org 2024-01-20 20:42 ` cvs-commit at gcc dot gnu.org 2024-01-20 20:43 ` mpolacek at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: mpolacek at gcc dot gnu.org @ 2024-01-18 22:53 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111410 --- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Thanks for the report. I think we should disable the warning for operator| coming from std::ranges. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/111410] Bogus Wdangling-reference warning with ranges pipe expression in for loop 2023-09-14 1:09 [Bug c++/111410] New: Bogus Wdangling-reference warning with ranges pipe expression in for loop hewillk at gmail dot com 2024-01-18 22:10 ` [Bug c++/111410] " mpolacek at gcc dot gnu.org 2024-01-18 22:53 ` mpolacek at gcc dot gnu.org @ 2024-01-20 20:42 ` cvs-commit at gcc dot gnu.org 2024-01-20 20:43 ` mpolacek at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2024-01-20 20:42 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111410 --- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:7db802d972e622242d015ecd5a8cecf63e69a45a commit r14-8307-g7db802d972e622242d015ecd5a8cecf63e69a45a Author: Marek Polacek <polacek@redhat.com> Date: Fri Jan 19 15:27:51 2024 -0500 libstdc++: suppress -Wdangling-reference with operator| [PR111410] It seems to me that we should exclude std::ranges::views::__adaptor::operator| from the -Wdangling-reference warning. It's commonly used when handling ranges. PR c++/111410 libstdc++-v3/ChangeLog: * include/std/ranges: Add #pragma to disable -Wdangling-reference with std::ranges::views::__adaptor::operator|. gcc/testsuite/ChangeLog: * g++.dg/warn/Wdangling-reference17.C: New test. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/111410] Bogus Wdangling-reference warning with ranges pipe expression in for loop 2023-09-14 1:09 [Bug c++/111410] New: Bogus Wdangling-reference warning with ranges pipe expression in for loop hewillk at gmail dot com ` (2 preceding siblings ...) 2024-01-20 20:42 ` cvs-commit at gcc dot gnu.org @ 2024-01-20 20:43 ` mpolacek at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: mpolacek at gcc dot gnu.org @ 2024-01-20 20:43 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111410 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 for 14. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-20 20:43 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-09-14 1:09 [Bug c++/111410] New: Bogus Wdangling-reference warning with ranges pipe expression in for loop hewillk at gmail dot com 2024-01-18 22:10 ` [Bug c++/111410] " mpolacek at gcc dot gnu.org 2024-01-18 22:53 ` mpolacek at gcc dot gnu.org 2024-01-20 20:42 ` cvs-commit at gcc dot gnu.org 2024-01-20 20:43 ` 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).