public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57528] New: Missed warning for putting reference to temporary in class member
@ 2013-06-04 18:07 jewillco at osl dot iu.edu
2013-06-05 0:10 ` [Bug c++/57528] " redi at gcc dot gnu.org
2013-06-05 18:26 ` paolo.carlini at oracle dot com
0 siblings, 2 replies; 3+ messages in thread
From: jewillco at osl dot iu.edu @ 2013-06-04 18:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57528
Bug ID: 57528
Summary: Missed warning for putting reference to temporary in
class member
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jewillco at osl dot iu.edu
It would be nice to have a warning on code such as:
struct b {
const int& r;
b(int r): r(r) {}
};
that is almost certainly unintended since it always binds a reference to a
temporary in a case where the reference outlives the temporary. "g++ (GCC)
4.9.0 20130519 (experimental)" does not warn on this code with -Wall -Wextra,
whether with -O2 or without. Uses of the struct b (including with a literal
number as constructor argument) do not produce warnings either.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-05 18:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04 18:07 [Bug c++/57528] New: Missed warning for putting reference to temporary in class member jewillco at osl dot iu.edu
2013-06-05 0:10 ` [Bug c++/57528] " redi at gcc dot gnu.org
2013-06-05 18:26 ` paolo.carlini at oracle dot com
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).