[Bug c++/109671] Spurious dangling reference warning in GCC 13

2024-01-19 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109671 Marek Polacek changed: What|Removed |Added Resolution|--- |DUPLICATE CC|

[Bug c++/109671] Spurious dangling reference warning in GCC 13

2023-05-02 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109671 --- Comment #4 from CVS Commits --- The releases/gcc-13 branch has been updated by Marek Polacek : https://gcc.gnu.org/g:6b927b1297e66e26e62e722bf15c921dcbbd25b9 commit r13-7276-g6b927b1297e66e26e62e722bf15c921dcbbd25b9 Author: Marek Polacek

[Bug c++/109671] Spurious dangling reference warning in GCC 13

2023-04-30 Thread lopresti at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109671 --- Comment #3 from Patrick J. LoPresti --- (In reply to Andrew Pinski from comment #1) > There is no way for GCC to know that get_foo_by_name does not store the > argument into what is returned so it warns about this case ... To summarize: GC

[Bug c++/109671] Spurious dangling reference warning in GCC 13

2023-04-28 Thread lopresti at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109671 --- Comment #2 from Patrick J. LoPresti --- Um... OK... So I have to "correct" my code like so: const Foo &bug(bool x) { const std::string s = (x ? "x" : "y"); const Foo &f = get_foo_by_name(s); return f; } But if get_foo_by_name() has

[Bug c++/109671] Spurious dangling reference warning in GCC 13

2023-04-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109671 --- Comment #1 from Andrew Pinski --- There is no way for GCC to know that get_foo_by_name does not store the argument into what is returned so it warns about this case ...