You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discovered in #1216, The C++20 std::reverse_iterator<ValueIterator> cannot perform ->, at least not in GCC.
This is because ValueIterator operators -> and * are const-incorrect.
To Reproduce
Json::Value v;
v["k1"] = "v1";
std::reverse_iterator it(value.end());
auto s = it->asString(); // This fails to compile, but `(*it).asString()`; is fine.
Expected behavior
operator-> and operator* should be const in ValueIterator as they are in ValueConstIterator.
Dereferencing an iterator is always a logical const operation, as providing such access does not change the iterator.
Desktop (please complete the following information):
OS: in my case, MacOS, using homebrew GCC-10.
Meson version N/A
Ninja version N/A
Additional context
A commit was made for this on #1216, but we could make it a standalone bugfix independent of C++20. 14e15b6
The text was updated successfully, but these errors were encountered:
Describe the bug
As discovered in #1216, The C++20
std::reverse_iterator<ValueIterator>
cannot perform->
, at least not in GCC.This is because
ValueIterator
operators->
and*
areconst
-incorrect.To Reproduce
Expected behavior
operator->
andoperator*
should beconst
inValueIterator
as they are inValueConstIterator
.Dereferencing an iterator is always a logical const operation, as providing such access does not change the iterator.
Desktop (please complete the following information):
Additional context
A commit was made for this on #1216, but we could make it a standalone bugfix independent of C++20.
14e15b6
The text was updated successfully, but these errors were encountered: