https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109671
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE CC| |mpolacek at gcc dot gnu.org Status|UNCONFIRMED |RESOLVED --- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> --- (In reply to Patrick J. LoPresti from comment #3) > (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: > > GCC is warning because it does not and cannot know whether I am managing > object lifetimes correctly. > > The only way to silence the warning is to modify my code to make it uglier, > into a form where GCC still does not and cannot know whether I am managing > lifetimes correctly. > > So is this a valid bug report, or not? It's valid but also I don't think I can tweak the heuristic not to warn here. There ought to be a simpler way to suppress the warning, see bug 109642. *** This bug has been marked as a duplicate of bug 109642 ***