Issue 142835
Summary Crash in constant evaluation of explicit object member assignment operator
Labels clang:frontend, c++23, crash-on-valid
Assignees
Reporter cor3ntin
    ```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
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to