1. 21 Jun, 2019 9 commits
  2. 20 Jun, 2019 28 commits
  3. 19 Jun, 2019 3 commits
    • Fix non-standard behaviour of std::istream_iterator · 638ad333
      The current implementation of istream_iterator allows the iterator to be
      reused after reaching end-of-stream, so that subsequent reads from the
      stream can succeed (e.g. if the stream state has been cleared and stream
      position changed from EOF). The P0738R2 paper clarified that the
      expected behaviour is to set the stream pointer to null after reaching
      end-of-stream, preventing further reads.
      
      This implements that requirement, and adds the new default constructor
      to std::ostream_iterator.
      
      	* include/bits/stream_iterator.h (istream_iterator::_M_equal()): Make
      	private.
      	(istream_iterator::_M_read()): Do not check stream state before
      	attempting extraction. Set stream pointer to null when extraction
      	fails (P0738R2).
      	(operator==(const istream_iterator&, const istream_iterator&)): Change
      	to be a hidden friend of istream_iterator.
      	(operator!=(const istream_iterator&, const istream_iterator&)):
      	Likewise.
      	(ostream_iterator::ostream_iterator()): Add default constructor.
      	(ostream_iterator::ostream_iterator(ostream_type*, const C*)): Use
      	addressof.
      	* testsuite/24_iterators/istream_iterator/1.cc: New test.
      	* testsuite/24_iterators/ostream_iterator/1.cc: New test.
      	* testsuite/24_iterators/ostream_iterator/70766.cc: Also check
      	constructor taking a string.
      	* testsuite/24_iterators/ostream_iterator/requirements/constexpr.cc:
      	New test.
      
      From-SVN: r272491
      Jonathan Wakely committed
    • Have std::vector printer's iterator return bool for vector<bool> · 36d0dada
      Have the pretty-printer for 'std::vector<bool>' return a
      value of type 'bool' rather than an 'int'.
      
      This way, the type is clear and that can be used for better
      display and a 'gdb.Value' constructed from the returned value
      will have type 'bool' again, not e.g. 'long long' as happened
      previously (at least with GDB 8.2.1 on amd64).
      
      2019-06-19  Michael Weghorn  <m.weghorn@posteo.de>
      	    Jonathan Wakely  <jwakely@redhat.com>
      
      	PR libstdc++/90945
      	* python/libstdcxx/v6/printers.py (StdVectorPrinter._iterator): Use
      	values of type bool for vector<bool> elements.
      	* testsuite/libstdc++-prettyprinters/simple.cc: Test vector<bool>.
      	* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
      
      Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>
      
      From-SVN: r272490
      Michael Weghorn committed
    • PR libstdc++/90920 restore previous checks for empty ranges · 0fd9e848
      The change in r263433 broke the contract of the __rotate functions, by no
      longer accepting empty ranges. That means that callers which inlined the
      old version of std::rotate (without checks) that end up linking to a new
      definition of std::__rotate (also without checks) could perform a divide
      by zero and crash.
      
      This restores the old contract of the __rotate overloads.
      
      	PR libstdc++/90920 partially revert r263433
      	* include/bits/stl_algo.h (__rotate): Restore checks for empty ranges.
      	(rotate): Remove checks.
      	* testsuite/25_algorithms/rotate/90920.cc: New test.
      
      From-SVN: r272489
      Jonathan Wakely committed