public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111159] New: [13 Regression] False positive -Wdangling-reference
@ 2023-08-25 23:21 daniel at constexpr dot org
2023-08-25 23:26 ` [Bug c++/111159] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: daniel at constexpr dot org @ 2023-08-25 23:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111159
Bug ID: 111159
Summary: [13 Regression] False positive -Wdangling-reference
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: daniel at constexpr dot org
Target Milestone: ---
GCC 13.2.0 as well as git from today report a false positive
-Wdangling-reference warning for the following C++ code:
struct A {
int * i;
int & b() { return *i; }
};
int g = 42;
A a() {
return A{ &g };
}
int main() {
const int & i = a().b();
return i;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/111159] [13 Regression] False positive -Wdangling-reference
2023-08-25 23:21 [Bug c++/111159] New: [13 Regression] False positive -Wdangling-reference daniel at constexpr dot org
@ 2023-08-25 23:26 ` pinskia at gcc dot gnu.org
2023-08-28 7:19 ` [Bug c++/111159] [13/14 " rguenth at gcc dot gnu.org
2024-01-19 23:32 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-25 23:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111159
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=109642
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect this is just a dup of bug 109642 .
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/111159] [13/14 Regression] False positive -Wdangling-reference
2023-08-25 23:21 [Bug c++/111159] New: [13 Regression] False positive -Wdangling-reference daniel at constexpr dot org
2023-08-25 23:26 ` [Bug c++/111159] " pinskia at gcc dot gnu.org
@ 2023-08-28 7:19 ` rguenth at gcc dot gnu.org
2024-01-19 23:32 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-28 7:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111159
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Summary|[13 Regression] False |[13/14 Regression] False
|positive |positive
|-Wdangling-reference |-Wdangling-reference
Target Milestone|--- |13.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/111159] [13/14 Regression] False positive -Wdangling-reference
2023-08-25 23:21 [Bug c++/111159] New: [13 Regression] False positive -Wdangling-reference daniel at constexpr dot org
2023-08-25 23:26 ` [Bug c++/111159] " pinskia at gcc dot gnu.org
2023-08-28 7:19 ` [Bug c++/111159] [13/14 " rguenth at gcc dot gnu.org
@ 2024-01-19 23:32 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-19 23:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111159
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think so too; I'm afraid there's no heuristic I could implement. You can
disable the warning for this class using:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdangling-reference"
struct A {
int * i;
int & b() { return *i; }
};
#pragma GCC diagnostic pop
*** This bug has been marked as a duplicate of bug 109642 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-19 23:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-25 23:21 [Bug c++/111159] New: [13 Regression] False positive -Wdangling-reference daniel at constexpr dot org
2023-08-25 23:26 ` [Bug c++/111159] " pinskia at gcc dot gnu.org
2023-08-28 7:19 ` [Bug c++/111159] [13/14 " rguenth at gcc dot gnu.org
2024-01-19 23:32 ` mpolacek 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).