public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63181] New: GCC should warn about "obvious" bugs in binding a reference to temporary
@ 2014-09-05 0:02 brooks at gcc dot gnu.org
2014-09-05 8:39 ` [Bug c++/63181] " rguenth at gcc dot gnu.org
2014-10-20 23:10 ` redi at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: brooks at gcc dot gnu.org @ 2014-09-05 0:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63181
Bug ID: 63181
Summary: GCC should warn about "obvious" bugs in binding a
reference to temporary
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: brooks at gcc dot gnu.org
GCC should warn about "obvious" bugs in binding a reference to temporary.
Small test case:
struct Foo {
Foo(int x): x_(x) { }
int& x_;
};
int main()
{
Foo f(0);
return f.x_;
}
Gcc -Wall is silent.
Clang detects this clearly:
clang++ foo.cc -Wall
foo.cc:2:19: warning: binding reference member 'x_' to stack allocated
parameter 'x' [-Wdangling-field]
Foo(int x): x_(x) { }
^
foo.cc:3:9: note: reference member declared here
int& x_;
^
1 warning generated.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/63181] GCC should warn about "obvious" bugs in binding a reference to temporary
2014-09-05 0:02 [Bug c++/63181] New: GCC should warn about "obvious" bugs in binding a reference to temporary brooks at gcc dot gnu.org
@ 2014-09-05 8:39 ` rguenth at gcc dot gnu.org
2014-10-20 23:10 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-09-05 8:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63181
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-09-05
Ever confirmed|0 |1
Severity|minor |enhancement
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/63181] GCC should warn about "obvious" bugs in binding a reference to temporary
2014-09-05 0:02 [Bug c++/63181] New: GCC should warn about "obvious" bugs in binding a reference to temporary brooks at gcc dot gnu.org
2014-09-05 8:39 ` [Bug c++/63181] " rguenth at gcc dot gnu.org
@ 2014-10-20 23:10 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-10-20 23:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63181
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bcmpinc at hotmail dot com
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 63606 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-20 22:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-05 0:02 [Bug c++/63181] New: GCC should warn about "obvious" bugs in binding a reference to temporary brooks at gcc dot gnu.org
2014-09-05 8:39 ` [Bug c++/63181] " rguenth at gcc dot gnu.org
2014-10-20 23:10 ` redi 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).