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

Piotr Nycz <piotrwn1 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |piotrwn1 at gmail dot com

--- Comment #5 from Piotr Nycz <piotrwn1 at gmail dot com> ---
Still not "enhanced" (gcc9). 
CLANG with its std-lib correctly (IMO) does not compile it.

I understand this is UB - but implementation might suggest it is checked that
iterator is biderectional (at least ) but this check has no effect.

```

  template<typename _BidirectionalIterator>
    inline _BidirectionalIterator
    prev(_BidirectionalIterator __x, typename
         iterator_traits<_BidirectionalIterator>::difference_type __n = 1) 
    {
      // concept requirements
      __glibcxx_function_requires(_BidirectionalIteratorConcept<
                                  _BidirectionalIterator>)
      std::advance(__x, -__n);
      return __x;
    }

``` 

it is very troublesome to realize that there is something wrong here - when you
have UB="very long time consuming loop (LONG_MAX iteration probably)"

Is there anything that can be done to increase importance of this enhancement?

Reply via email to