https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115730
Bug ID: 115730
Summary: False positive dangling-reference warning
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: igor_anferov at icloud dot com
Target Milestone: ---
It looks like saving any constant reference returned by the class method called
on temporary object causes a “dangling-reference” warning in GCC (including
latest versions). Short reproducer can be found here:
http://godbolt.org/z/GcE6GM1cs