2017-11-13 21:23 GMT+01:00 François Dumont <frs.dum...@gmail.com>: > On 10/11/2017 21:57, Jonathan Wakely wrote: >>> diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h >>> b/libstdc++-v3/include/bits/streambuf_iterator.h >>> index 0a6c7f9..b60626a 100644 >>> --- a/libstdc++-v3/include/bits/streambuf_iterator.h >>> +++ b/libstdc++-v3/include/bits/streambuf_iterator.h >>> @@ -417,6 +421,55 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >>> return __last; >>> } >>> >>> + template<typename _CharT, typename _Distance> >>> + inline _GLIBCXX17_CONSTEXPR void >> >> >> This function can never be constexpr. > > I just replicate the _GLIBCXX17_CONSTEXPR qualification of the general > std::advance overload. I am not clear about those different constexpr > concepts but I also found strange that it could be consider as such.
The general std::advance function can be constexpr, depending on the actual iterator, e.g. #include <iterator> template<class T> constexpr T* next(T* p) { std::advance(p, 1); return p; } int main() { static int arr[2] = {1, 2}; constexpr int* p = next(arr); } but as Jonathan already said, for std::istreambuf_iterator<T> this can never be true (because of the involved IO operations). - Daniel