https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109774
Bug ID: 109774 Summary: Spurious dangling reference warning in GCC 13 - another variant Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: minty.bobby at gmail dot com Target Milestone: --- Created attachment 55021 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55021&action=edit the function get() gives a spurious warning, but the very similar function get2() does not Similar to some of the other bug reports involving the new dangling reference warning, but here we have 2 very similar functions, and only one gives the warning. Perhaps there is scope to tweak the heuristics to improve this case? In the attached file, the templated function get() gives a spurious warning, but the very similar but non-template function get2() does not. Note the reference passed in is of a different type to the reference that is returned - I don't feel there should be confusion between them?