[LLVMdev] MS VS2010 std implementation: "Cannot assign iterators to two different blocks!"

Duncan Sands baldrick at free.fr
Wed Oct 20 04:59:30 PDT 2010


Hi Bob, was this issue resolved?

Ciao,

Duncan.

> When using MS VS2010 there is an issue with std:
>
> `SuccIterator` implements a partial assignment operator:
>
> inline const _Self &operator=(const _Self &I) {
>
> assert(Term == I.Term &&"Cannot assign iterators to two different blocks!");
>
> idx = I.idx;
>
> return *this;
>
> }
>
> For copy construction, MS VS2010 std reserves the right, and sometimes calls,
>
> a method to reverse elements which does so by swap:
>
> template<class _Ty> inline
>
> void swap(_Ty& _Left, _Ty& _Right)
>
> { // exchange values stored at _Left and _Right
>
> _Ty _Tmp = _Move(_Left);
>
> _Left = _Move(_Right); <<<<<<<<<<<<< Needs FULL assignment operator!!!!
>
> _Right = _Move(_Tmp);
>
> }
>
> When `_Ty` is `SuccIterator const` the assert "Cannot assign iterators to two
> different blocks!" can fail.
>
> Can this be a workaround:
>
> inline const _Self &operator=(const _Self &I) {
>
> new (this) _Self(I);
>
> return *this;
>
> }
>
> The larger question is can both the assert be preserved and swap satisfied?
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list