https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115987
--- Comment #24 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:7232bc180632f0ccce260bd33598faf6297d4fe6 commit r14-10726-g7232bc180632f0ccce260bd33598faf6297d4fe6 Author: Marek Polacek <pola...@redhat.com> Date: Wed Jul 31 17:33:55 2024 -0400 c++: fix -Wdangling-reference false positive [PR115987] This fixes another false positive. When a function is taking a temporary of scalar type that couldn't be bound to the return type of the function, don't warn, such a program would be ill-formed. Thanks to Jonathan for reporting the problem. PR c++/115987 gcc/cp/ChangeLog: * call.cc (do_warn_dangling_reference): Don't consider a temporary with a scalar type that cannot bind to the return type. gcc/testsuite/ChangeLog: * g++.dg/ext/attr-no-dangling6.C: Adjust. * g++.dg/ext/attr-no-dangling7.C: Likewise. * g++.dg/warn/Wdangling-reference22.C: New test.