https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106388
Bug ID: 106388 Summary: Support for use-after-move in -fanalyzer Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Blocks: 97110 Target Milestone: --- Flag use-after-move, for some types at least. For most std::lib types, they are in a "valid, but unspecified" state after being moved. That means they maintain their invariants, but beyond that you don't know if they are empty, unaltered, or full of arbitrary values. Allow functions that have no preconditions, as those are always allowed on a moved-from object. e.g. - vector::empty() or vector::size() is safe on a moved-from vector, but vector::front() isn't safe until you've checked whether or not it's empty. - vector::clear() is safe on any vector, and restores it to a known state (i.e empty). Knowing which functions have preconditions or not requires knowledge of the type, which PR 106386 would help with. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97110 [Bug 97110] [meta-bug] tracker bug for supporting C++ in -fanalyzer