public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102482] Winit-list-lifetime false positive for temporaries with std::initializer_list Date: Sun, 26 Sep 2021 11:08:00 +0000 [thread overview] Message-ID: <bug-102482-4-D3DRmgTOjD@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102482-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102482 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Federico Kircheis from comment #0) > While the warning is true, the code is completely safe, but the warnings > seems to imply that foo will access a dangling pointer. In this case it's safe because the span obejct has the same lifetime as the initializer_list, but in general that's not true. The warning comes from the constructor, and is independent of the context in which it's being constructed. > so I assume the warning is std::initializer_list specific. Yes. std::initializer_list is a magic language type that the compiler knows all about. std::vector is just opaque C++ code that the compiler knows nothing about.
next prev parent reply other threads:[~2021-09-26 11:08 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-25 12:38 [Bug c++/102482] New: " federico.kircheis at gmail dot com 2021-09-26 11:08 ` redi at gcc dot gnu.org [this message] 2021-09-26 11:08 ` [Bug c++/102482] " redi at gcc dot gnu.org 2021-09-26 11:10 ` redi at gcc dot gnu.org 2021-09-29 5:39 ` federico.kircheis at gmail dot com 2021-09-29 9:23 ` redi at gcc dot gnu.org 2021-09-29 9:25 ` redi at gcc dot gnu.org 2021-09-29 10:16 ` redi at gcc dot gnu.org 2021-10-04 12:22 ` redi at gcc dot gnu.org 2021-10-07 13:55 ` cvs-commit 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-102482-4-D3DRmgTOjD@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).