https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95289
Bug ID: 95289 Summary: __gnu_debug::__get_distance is not C++11 constexpr compliant Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: andysem at mail dot ru Target Milestone: --- The following test case fails to compile in C++11 mode: #include <vector> #include <fstream> #include <iterator> void foo() { typedef std::istream_iterator<char> is_iter; std::ifstream ifs1("test.dat"); std::vector<char> data1; is_iter it1(ifs1), it_end; std::copy(it1, it_end, std::back_inserter(data1)); } $ g++ -std=c++11 -D_GLIBCXX_DEBUG /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/debug/helper_functions.h:108:5: error: body of 'constexpr' function 'constexpr typename __gnu_debug::_Distance_traits<_Iterator>::__type __gnu_debug::__get_distance(_Iterator, _Iterator, std::input_iterator_tag) [with _Iterator = std::istream_iterator<char>; typename __gnu_debug::_Distance_traits<_Iterator>::__type = std::pair<long int, __gnu_debug::_Distance_precision>]' not a return-statement https://gcc.godbolt.org/z/6Aa1ce This is a regression since gcc 9.