Opened 5 years ago
Last modified 5 years ago
#13357 new Bugs
boost::iterator_range<boost::counting_iterator<uint64_t>>::back() returns reference to temporary
| Reported by: | Owned by: | Neil Groves | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | range |
| Version: | Boost 1.61.0 | Severity: | Problem |
| Keywords: | range | Cc: |
Description
boost::iterator_range<boost::counting_iterator<uint64_t>>::back() returns reference to temporary
it's created by
using RangeRawType = std::uint64_t;
inline Range makeRange(
RangeRawType begin,
RangeRawType end = std::numeric_limits<RangeRawType>::max())
{
return boost::counting_range<RangeRawType>(begin, end);
}
After investigation code of back() it probably returns reference to temporary value:
reference back() const
{
BOOST_ASSERT(!this->empty());
return *boost::prior(this->m_End);
}
So it returns just a junk (or rather this reference points to some random data).
Code is the same in the newest boost (1.66 at time of writing).
Note:
See TracTickets
for help on using tickets.
