https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127540

--- Comment #9 from François Dumont <fdumont at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #8)
> (In reply to François Dumont from comment #7)
> > What about fixing it this way ?
> 
> Would this mean that a copy of a moved-from iterator would be in the
> value-initialized state, but the moved-from iterator itself would not be?
>

Yes, indeed.

I'm seeing things more in terms of singularity. With this approach a singular
iterator would give a singular iterator after copy or move. With current code
only the assertion prevent a singular iterator to give a valid iterator on
copy.

Of course it means that a problem would trigger an assertion only when the
iterator is actually used for something. __msg_init_copy_singular or
__msg_copy_singular won't be used anymore.

> > IMHO to detect that iterator's lifetime hasn't started yet is a compiler's
> > job, not _GLIBCXX_DEBUG mode one.
> 
> A nice idea in theory, but impossible in practice because C++ supports
> separate compilation.

It could at least do it within a Translation Unit, no ?

Reply via email to