C++ Logo

std-discussion

Advanced search

another potential ambiguity for assign.op.

From: mauro russo <ing.russomauro_at_[hidden]>
Date: Sat, 4 Jul 2026 17:18:19 +0200
in [class.copy.assign]-p(12.3) :

It is unspecified whether subobjects representing virtual base
classes are assigned more than once by the implicitly-defined
copy/move assignment operator.


I see no problem here about copy-case, but for the move-case,
wouldn't it be an error to move more than once ?
Is it really unspecified whether the compiler would perform the
move more than once ? It's like inhibiting the use of the implicit
definition for virtual base classes where move-semantics makes
sense. I mean, if the first move changes the source subobject
state, then second move would get from the subobject which
by then has a modified state.
Is there any other rule to in the standard that forces the compiler
to assure a consistent result ? (e.g., leading to unspecified
multiple move only in case move falls back to copy).

Received on 2026-07-04 15:18:32