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

    <tr>
        <th>Summary</th>
        <td>
            Crash in constant evaluation of explicit object member assignment operator
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            c++23,
            crash-on-valid
      </td>
    </tr>

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

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

<pre>
    ```cpp
struct MoveMe {
  MoveMe& operator=(this MoveMe&, const MoveMe&) = default;
 constexpr MoveMe& operator=(this MoveMe& self, MoveMe&& other) {
 self.value = other.value;
    other.value = 0;
    return self;
  }
  int value = 4242;
};

struct S {
  S& operator=(this S&, const S&) = default;
  S& operator=(this S&, S&&) = default;

  MoveMe move_me;
};

constexpr bool f() {
  S s1{};
  S s2{};
  s2 = s1;
 return true;
}

static_assert(f());
```

`
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/ExprConstant.cpp:6656: bool HandleFunctionCall(clang::SourceLocation, const clang::FunctionDecl*, const {anonymous}::LValue*, const clang::Expr*, llvm::ArrayRef<const clang::Expr*>, {anonymous}::CallRef, const clang::Stmt*, {anonymous}::EvalInfo&, clang::APValue&, const {anonymous}::LValue*): Assertion `This && (MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator())' failed.
`

https://compiler-explorer.com/z/1nxjPP5Yh
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVF2PrCgT_jXlDekO4kfrhReOPeZ9kzPZyfbJJnt1gordnCAYwM7M_voNqK2zO5M9CQlQ9VQV9VQV1Bh-lYwVkDxBcg7oZG9KF63SkbRcBo3q3gtI8bzacQRcGqun1qIXdWcvDMHpCXCJliuQFKmRaWqVhugMJLM3bjYlkAq1Shq7F-UIojPqWE8nYSHy_jyIvY36Fx0jw0TvvO_8pkjZG9M-wPxKBzreqZi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