[PATCH][_GLIBCXX_DEBUG][__cplusplus >= 201103L] Remove useless workaround
François Dumont
frs.dumont@gmail.com
Sat Mar 21 13:35:39 GMT 2026
Still no chance to reproduce this problem.
I think the patch is good and that you are simply missing it in the
below build.
The compiler is reporting the error coming from:
/home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/string:238:
required from '__gnu_debug::basic_string<_CharT, _Traits,
_Allocator>::basic_string(_InputIterator, _InputIterator, const
_Allocator&) [with _InputIterator = int; _CharT = char; _Traits =
std::char_traits<char>; _Allocator = std::allocator<char>]'
Line 238 is the former line of the call
to __glibcxx_check_valid_constructor_range(__begin, __end) that is
leading to the error.
After my patch it is on line 243.
François
On 3/18/26 17:40, Tomasz Kaminski wrote:
>
>
> On Mon, Mar 9, 2026 at 12:04 PM Tomasz Kaminski <tkaminsk@redhat.com>
> wrote:
>
> I believe, this caused failure
> 21_strings/basic_string/requirements/dr438/constructor.c in C++20
> mode::
> In file included from
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/functions.h:39,
> from
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/safe_sequence.h:34,
> from
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/string:37,
> from
> /home/tkaminsk/src/gcc/libstdc++-v3/testsuite/21_strings/basic_string/requirements/dr438/constructor.cc:23:
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/helper_functions.h:
> In instantiation of 'constexpr bool
> __gnu_debug::__valid_range(_InputIterator, _InputIterator) [with
> _InputIterator = int]':
>
> The full test suite showed 705 failures for _GLIBCXX_DEBUG=1 run, and
> every one I checked has the same error. They may be other, but are
> very hard to find.
> They are mostly point toward basic_regexp or basic_string.
> See the attachment for the full list.
>
> (The workaround seems far for useless currently).
>
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/functions.h:65:
> required from 'constexpr _InputIterator
> __gnu_debug::__check_valid_range(const _InputIterator&, const
> _InputIterator&, const char*, unsigned int, const char*) [with
> _InputIterator = int]'
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/string:238:
> required from '__gnu_debug::basic_string<_CharT, _Traits,
> _Allocator>::basic_string(_InputIterator, _InputIterator, const
> _Allocator&) [with _InputIterator = int; _CharT = char; _Traits =
> std::char_traits<char>; _Allocator = std::allocator<char>]'
> /home/tkaminsk/src/gcc/libstdc++-v3/testsuite/21_strings/basic_string/requirements/dr438/constructor.cc:28:
> required from here
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/helper_functions.h:212:
> error: no matching function for call to '__iterator_category(int&)'
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/helper_functions.h:212:
> note: there is 1 candidate
> In file included from
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_construct.h:61,
> from
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:59,
> from
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/string:45,
> from
> /home/tkaminsk/src/gcc/libstdc++-v3/testsuite/21_strings/basic_string/requirements/dr438/constructor.cc:22:
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator_base_types.h:241:
> note: candidate 1: 'template<class _Iter> constexpr typename
> std::iterator_traits<_Iterator>::iterator_category
> std::__iterator_category(const _Iter&)'
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator_base_types.h:241:
> note: template argument deduction/substitution failed:
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator_base_types.h:
> In substitution of 'template<class _Iter> constexpr typename
> std::iterator_traits<_Iterator>::iterator_category
> std::__iterator_category(const _Iter&) [with _Iter = int]':
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/helper_functions.h:212:
> required from 'constexpr bool
> __gnu_debug::__valid_range(_InputIterator, _InputIterator) [with
> _InputIterator = int]'
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/functions.h:65:
> required from 'constexpr _InputIterator
> __gnu_debug::__check_valid_range(const _InputIterator&, const
> _InputIterator&, const char*, unsigned int, const char*) [with
> _InputIterator = int]'
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/string:238:
> required from '__gnu_debug::basic_string<_CharT, _Traits,
> _Allocator>::basic_string(_InputIterator, _InputIterator, const
> _Allocator&) [with _InputIterator = int; _CharT = char; _Traits =
> std::char_traits<char>; _Allocator = std::allocator<char>]'
> /home/tkaminsk/src/gcc/libstdc++-v3/testsuite/21_strings/basic_string/requirements/dr438/constructor.cc:28:
> required from here
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator_base_types.h:241:
> error: no type named 'iterator_category' in 'struct
> std::iterator_traits<int>'
> compiler exited with status 1
> FAIL: 21_strings/basic_string/requirements/dr438/constructor.cc
> -std=gnu++20 (test for excess errors)
> Excess errors:
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/helper_functions.h:212:
> error: no matching function for call to '__iterator_category(int&)'
> /home/tkaminsk/build/gcc/16/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator_base_types.h:241:
> error: no type named 'iterator_category' in 'struct
> std::iterator_traits<int>'
>
>
> On Mon, Mar 2, 2026 at 7:00 AM François Dumont
> <frs.dumont@gmail.com> wrote:
>
> Hi
>
> libstdc++: [_GLIBCXX_DEBUG][__cplusplus >= 201103L]
> Remove useless
> workaround
>
> Starting with C++11 we leverage on template parameter
> requirement
> to prevent
> instantiation of methods taking iterators with invalid types.
> So the _GLIBCXX_DEBUG mode do not need to check for
> potential
> ambiguity between
> integer type and iterator type anymore.
>
> libstdc++-v3/ChangeLog:
>
> * include/debug/functions.h
> [__cplusplus >= 201103L](__foreign_iterator_aux):
> Remove.
> [__cplusplus >= 201103L](__foreign_iterator):
> Adapt to use
> __foreign_iterator_aux2.
> * include/debug/helper_functions.h
> [__cplusplus >= 201103L]: Remove include
> bits/cpp_type_traits.h.
> [__cplusplus >= 201103L](_Distance_traits<_Integral,
> std::__true_type>): Remove.
> [__cplusplus >=
> 201103L](__valid_range_aux(_Integral,
> _Integral, std::__true_type)):
> Remove.
> [__cplusplus >=
> 201103L](__valid_range_aux(_Iterator,
> _Iterator, std::__false_type)):
> Remove.
> [__cplusplus >= 201103L]
> (__valid_range_aux(_Integral, _Integral,
> _Distance_traits<_Integral>::__type&,
> std::__true_type)): Remove.
> [__cplusplus >= 201103L]
> (__valid_range_aux(_Iterator, _Iterator,
> _Distance_traits<_Iterator>::__type&,
> std::__false_type)): Remove.
> [__cplusplus >= 201103L](__valid_range(_Iterator,
> _Iterator)): Adapt.
> [__cplusplus >= 201103L]
> (__valid_range(_Iterator, _Iterator,
> _Distance_traits<_Iterator>::__type&)): Adapt.
>
> Tested under Linux x64 _GLIBCXX_DEBUG mode.
>
> Ok to commit ?
>
> François
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20260321/2541896b/attachment-0001.htm>
More information about the Libstdc++
mailing list