https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115987
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Status|UNCONFIRMED |RESOLVED --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- You either need to use gnu::no_dangling (with GCC 14+) or #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" ... #pragma GCC diagnostic pop As mentioned in PR 109642. This is not exactly a false positive since GCC does not look further into the functions to see if they return the reference or not. *** This bug has been marked as a duplicate of bug 109642 ***