<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62517>62517</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Static-Analyzer cplusplus.Move is unaware of std::lib types with well defined move semantics
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:static analyzer
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          njames93
      </td>
    </tr>
</table>

<pre>
    The static analyzer is currently unaware of types defined in the standard library with a valid and specified state after calling move, resulting in false positives.

In this example:
```cpp
#include <vector>

template <typename T>
void eat(std::vector<T>);

bool cond();

void foo() {
 std::vector<int> a;
    while (cond()) {
        if (cond()) {
 eat(std::move(a));
        }
        a.push_back(2);
 }
}
```

According to the standard, A moved from vector is:
- Guaranteed to be empty
- Has it's allocator moved from, which if the allocator was `std::allocator` is a no-op and as such results in a valid state.

However the static-analyzer complains that after the call to `eat`, `a` is left in a valid but unspecified state, despeite the fact its known to be in a valid and empty state.

Ideally the analyzer should be aware of standard library types which are left in a valid and specified state after moves, and It should also be aware of their allocators when determining their state

https://godbolt.org/z/xrjeoeqhM
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VU1z4jgQ_TXi0hXKSIHggw9MMuzkMKed-1ZbamNlZMkrtWGYX78lGxxIdtfFV0nd7_XH6wZTsgdPVIn1F7F-WeDAbYiVf8OOUqkWdTDn6kdLkBjZakCP7vybItgEeoiRPLszDB5PGAlCA3zuKYGhxnoyYD3w5OwNRgPO1hHjGU6WW0A4orMG0BtIPWnbWDIjEQE2TBE0Omf9AbpwJCGfIVIaHOcT66FBlwj6kCzbI6WlKF5EsZs-XzOvTUC_sOsdCXU5F5tieum-v5xIZb12gyEQ6vlImkMU6ustGFPXuxyUUM85PY8dwY_Z6BisAUIWcpvYZCq1u-I8j2ayFOrLLWIdggMdvBFy-_l2BGxCmC5B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