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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] bugprone-use-after-move false positive
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    clang-tidy 15.0.7 produces a warning in the following code on the commented line.
I believe it is a false positive because it is being reassigned.
 
```cpp
#include <memory>
#include <variant>

struct expression;

struct identifier_expression {};

struct binary_expression {
        binary_operator op;
        std::shared_ptr<expression> lhs;
        std::shared_ptr<expression> rhs;
};

using expression_variant = std::variant<identifier_expression, binary_expression>;
struct expression : expression_variant {
        using expression_variant::expression_variant;
        using expression_variant::operator=;
};

template<typename Value, typename T = std::remove_reference_t<Value>>
auto wrap(Value&& init) -> std::unique_ptr<T>
{
        return std::make_unique<T>(std::forward<Value>(init));
}

expression parse_expr();

binary_expression simplify_binary_expr(binary_operator op)
{
        expression lhs = parse_expr();
        expression rhs = parse_expr();
        if (op == binary_operator::assign_add) {
                rhs = binary_expression{ // 'rhs' used after it was moved [bugprone-use-after-move]
                        .op = binary_operator::add,
                        .lhs = wrap(lhs),
                        .rhs = wrap(std::move(rhs)),
                };
                op = binary_operator::assign;
        }

        return {
                .op = op,
                .lhs = wrap(std::move(lhs)),
                .rhs = wrap(std::move(rhs)),
        };
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVk2v6jYQ_TXDZgRKHPK1yOJeeKjdP3WLnHgAt46d2g6Uf185BAgf9-q1UpRInjnjM2dm7HDn5F4TVZB-Qrqe8d4fjK1-I0GCZrUR56pRXO_nXoozxukiWuTYWSP6hhxyPHGrpd6j1OgPhDujlDmFhcYIQnNZbUzbkvYkUElNC4jWEH38jjUpSUdC6VG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