public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107488] New: [13 Regression] -Werror=dangling-reference false positives in cppunit Date: Tue, 01 Nov 2022 08:02:58 +0000 [thread overview] Message-ID: <bug-107488-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107488 Bug ID: 107488 Summary: [13 Regression] -Werror=dangling-reference false positives in cppunit Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- cppunit-1.15.1 and a few other projects fail to compile due to -Werror on -Werror=dangling-reference. I think those are false positives. Extracted example from cppunit: // $ cat a.cpp.cpp #include <vector> int attributesAsString(std::vector<int> & v) { int attributes; std::vector<int>::const_iterator itAttribute = v.begin(); while ( itAttribute != v.end() ) { const int &attribute = *itAttribute++; attributes += attribute; } return attributes; } $ g++-13.0.0 -Werror=dangling-reference -c a.cpp.cpp -o a.o a.cpp.cpp: In function 'int attributesAsString(std::vector<int>&)': a.cpp.cpp:12:16: error: possibly dangling reference to a temporary [-Werror=dangling-reference] 12 | const int &attribute = *itAttribute++; | ^~~~~~~~~ a.cpp.cpp:12:40: note: the temporary was destroyed at the end of the full expression 'itAttribute.__gnu_cxx::__normal_iterator<const int*, std::vector<int> >::operator++(0).__gnu_cxx::__normal_iterator<const int*, std::vector<int> >::operator*()' 12 | const int &attribute = *itAttribute++; | ^~ $ g++-13.0.0 -v Using built-in specs. COLLECT_GCC=/<<NIX>>/gcc-13.0.0/bin/g++ COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-13.0.0/libexec/gcc/x86_64-unknown-linux-gnu/13.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20221030 (experimental) (GCC)
next reply other threads:[~2022-11-01 8:03 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-01 8:02 slyfox at gcc dot gnu.org [this message] 2022-11-01 15:56 ` [Bug c++/107488] " pinskia at gcc dot gnu.org 2022-11-01 20:50 ` mpolacek at gcc dot gnu.org 2022-11-03 19:46 ` cvs-commit at gcc dot gnu.org 2022-11-03 19:48 ` mpolacek at gcc dot gnu.org 2022-11-04 8:14 ` slyfox 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-107488-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).