public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hewillk at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111410] New: Bogus Wdangling-reference warning with ranges pipe expression in for loop Date: Thu, 14 Sep 2023 01:09:58 +0000 [thread overview] Message-ID: <bug-111410-4@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2023-09-14 1:10 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-14 1:09 hewillk at gmail dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-111410-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).