https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107106
David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2022-09-30 Blocks| |97110 --- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Thanks for filing this bug; confirmed. Note that the simpler: std::string square(int num) { return std::to_string(num); } also gives the warning. Note that I recommend *not* using -fanalyzer on C++ code for now; see tracker bug 97110. I'm guessing the issue is due to -fanalyzer failing to cope with exceptions and exception-handling (bug 97111). In the meantime, this is a test case that we'll eventually want to get working, so keeping open. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97110 [Bug 97110] [meta-bug] tracker bug for supporting C++ in -fanalyzer