diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-07-16 09:44:42 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-07-16 09:44:42 -0400 |
commit | 1af937eb6246ad7f63ebff03590e9eede33aca81 (patch) | |
tree | 9c21bb371353baec99f9ac82667e07af93532494 /libstdc++-v3/include/std/limits | |
parent | 73464a472aa4e86359f1a5dc529394fe5152fec0 (diff) | |
download | gcc-1af937eb6246ad7f63ebff03590e9eede33aca81.zip gcc-1af937eb6246ad7f63ebff03590e9eede33aca81.tar.gz gcc-1af937eb6246ad7f63ebff03590e9eede33aca81.tar.bz2 |
libstdc++: invalid default init in _CachedPosition [PR101231]
The primary template for _CachedPosition is a dummy implementation for
non-forward ranges, the iterators for which generally can't be cached.
Because this implementation doesn't actually cache anything, _M_has_value
is defined to be false and so calls to _M_get (which are always guarded
by _M_has_value) are unreachable.
Still, to suppress a "control reaches end of non-void function" warning
I made _M_get return {}, but after P2325 input iterators are no longer
necessarily default constructible so this workaround now breaks valid
programs.
This patch fixes this by instead using __builtin_unreachable to squelch
the warning.
PR libstdc++/101231
libstdc++-v3/ChangeLog:
* include/std/ranges (_CachedPosition::_M_get): For non-forward
ranges, just call __builtin_unreachable.
* testsuite/std/ranges/istream_view.cc (test05): New test.
Diffstat (limited to 'libstdc++-v3/include/std/limits')
0 files changed, 0 insertions, 0 deletions