https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671
--- Comment #66 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Michael Matz from comment #64) > I would find it extremely surprising if in > > a = b; > > the RHS doesn't constitute an access to the value of object 'b' (even > depending on the type of b). Are you really saying this Jason? (just trying > to make extra sure) Well, there's a kind of access involved in forming a reference to each of the members of b. I'm having trouble finding text pertaining to this; the closest I'm coming up with is in 12.7 [class.cdtor]: To form a pointer to (or access the value of) a direct non-static member of an object obj, the construction of obj shall have started and its destruction shall not have completed, otherwise the computation of the pointer value (or accessing the member value) results in undefined behavior. > (e.g. 5.17/2 is saying about the assignment operator, before any > differentiation between class and non-class types: > "In simple assignment (=), the value of the expression replaces that of the > object referred to by the left operand." > How could it talk about the value of the expression if the RHS doesn't > constitute an access to the value of that expression? While /4 specifies that > the actual assignment is carried out by the copy/move assignment operator > and hence via object representation for unions when implicit (12.8/29), we > cannot simply ignore the above sentence, can we?) The operator semantics described in clause 5 [expr] apply to the built-in operators, not any overloaded operators. Assignment of classes is always done by way of an assignment operator function, even if it happens to be trivial and therefore open-coded as a block copy, so the above doesn't apply to classes.