Why is that undefined behaviour?
struct s
{
const int id; // <-- const member
s(int id):
id(id)
{}
s& operator =(const s& m) {
return *new(this) s(m); // <-- undefined behavior?
}
};
(Quote from the standard would be nice).
This question arose from this answer.