Closed
Description
Found when reporting #86398, so it may be related to it.
But with the following valid code, at all optimization levels, the following code does not generate correctly.
volatile int a = 0;
struct function {
function& operator=(function const&) {
a = 1;
return *this;
}
};
int main() {
function list;
[&list](this auto self) {
list = function{};
}();
}
Clang does not generate a call to function::operator=
, and therefor does not set a
to 1.
Both GCC and MSVC generate the code correctly.
Godbolt