Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Vrany <jan@vrany.io>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v4 15/16] Allow the use of C++20 std::span in gdbsupport/span.h
Date: Fri, 20 Nov 2026 15:52:49 +0000	[thread overview]
Message-ID: <7e87cf228454f373b9f1e70816b01db5225bfed8.camel@vrany.io> (raw)
In-Reply-To: <20261118-span-part-1-v4-15-5ecf901e570b@adacore.com>

On Wed, 2026-11-18 at 15:56 -0700, Tom Tromey wrote:
> This patch changes gdbsupport/span.h to check __cplusplus and then to
> use std::span in this setup.
> 
> Eventually, when gdb moves to C++20 (PR gdb/32660), this header can be
> greatly simplified and we can rewrite "gdb::span" to "std::span".
> Note that the header won't be really removable, because there are some
> utility functions here that will need to remain.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31422

I just noticed that this breaks when compiling with -D_GLIBCXX_DEBUG=1 :

  CXX    unittests/span-selftests.o
In file included from /usr/include/c++/16/debug/debug.h:90,
                 from /usr/include/c++/16/bits/stl_algobase.h:68,
                 from /usr/include/c++/16/bits/hashtable_policy.h:37,
                 from /usr/include/c++/16/bits/hashtable.h:37,
                 from /usr/include/c++/16/bits/unordered_map.h:33,
                 from /usr/include/c++/16/unordered_map:43,
                 from /usr/include/c++/16/functional:80,
                 from ./../gdbsupport/ptid.h:35,
                 from ./../gdbsupport/common-defs.h:212,
                 from ././defs.h:26,
                 from <command-line>:
/usr/include/c++/16/span: In instantiation of ‘constexpr std::span<_Type, _Extent>::span(_It, _End) [with _It = const unsigned char*; _End = unsigned char*; _Type = const unsigned char; long unsigned int _Extent = 18446744073709551615]’:
unittests/span-selftests.c:332:41:   required from here
  332 |   gdb::span<const gdb_byte> view1 (cp, p);
      |                                         ^
/usr/include/c++/16/span:196:11: error: no matching function for call to ‘__valid_range(const unsigned char*&, unsigned char*&)’
  196 |         { __glibcxx_requires_valid_range(__first, __last); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • there are 8 candidates
In file included from /usr/include/c++/16/debug/stl_iterator.h:32,
                 from /usr/include/c++/16/bits/stl_iterator.h:3133,
                 from /usr/include/c++/16/bits/ranges_base.h:39,
                 from /usr/include/c++/16/bits/ranges_util.h:34,
                 from /usr/include/c++/16/tuple:46,
                 from /usr/include/c++/16/functional:71:
    • candidate 1: ‘template<class _InputIterator> constexpr bool __gnu_debug::__valid_range(_InputIterator, _InputIterator)’
      /usr/include/c++/16/debug/helper_functions.h:200:5:
        200 |     __valid_range(_InputIterator __first, _InputIterator __last)
            |     ^~~~~~~~~~~~~
      • template argument deduction/substitution failed:
        •   deduced conflicting types for parameter ‘_InputIterator’ (‘const unsigned char*’ and ‘unsigned char*’)
          /usr/include/c++/16/span:196:11:
            196 |         { __glibcxx_requires_valid_range(__first, __last); }
                |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • candidate 2: ‘template<class _InputIterator> constexpr bool __gnu_debug::__valid_range(_InputIterator, _InputIterator, typename _Distance_traits<_Iterator>::__type&)’
      /usr/include/c++/16/debug/helper_functions.h:219:5:
        219 |     __valid_range(_InputIterator __first, _InputIterator __last,
            |     ^~~~~~~~~~~~~
      • candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/16/debug/unordered_map:53,
                 from /usr/include/c++/16/unordered_map:48:
    • candidate 3: ‘template<class _Iterator, class _Sequence, class _Category> constexpr bool __gnu_debug::__valid_range(const _Safe_iterator<_Iterator, _Sequence, _Category>&, const _Safe_iterator<_Iterator, _Sequence, _Category>&, typename _Distance_traits<_Iterator>::__type&)’
      /usr/include/c++/16/debug/safe_iterator.h:1119:5:
       1119 |     __valid_range(const _Safe_iterator<_Iterator, _Sequence,
            |     ^~~~~~~~~~~~~
      • candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/16/debug/unordered_map:54:
    • candidate 4: ‘template<class _Iterator, class _Sequence> bool __gnu_debug::__valid_range(const _Safe_local_iterator<_Iterator, _Sequence>&, const _Safe_local_iterator<_Iterator, _Sequence>&, typename _Distance_traits<_Iterator>::__type&)’
      /usr/include/c++/16/debug/safe_local_iterator.h:415:5:
        415 |     __valid_range(const _Safe_local_iterator<_Iterator, _UContainer>& __first,
            |     ^~~~~~~~~~~~~
      • candidate expects 3 arguments, 2 provided
    • candidate 5: ‘template<class _Iterator, class _Sequence, class _Category> constexpr bool __gnu_debug::__valid_range(const _Safe_iterator<_Iterator, _Sequence, _Category>&, const _Safe_iterator<_Iterator, _Sequence, _Category>&)’
      /usr/include/c++/16/debug/safe_iterator.h:1134:5:
       1134 |     __valid_range(const _Safe_iterator<_Iterator, _Sequence,
            |     ^~~~~~~~~~~~~
      • template argument deduction/substitution failed:
        •   mismatched types ‘const __gnu_debug::_Safe_iterator<_Iterator, _Sequence, _Category>’ and ‘const unsigned char*’
          /usr/include/c++/16/span:196:11:
            196 |         { __glibcxx_requires_valid_range(__first, __last); }
                |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • candidate 6: ‘template<class _Iterator, class _Sequence> bool __gnu_debug::__valid_range(const _Safe_local_iterator<_Iterator, _Sequence>&, const _Safe_local_iterator<_Iterator, _Sequence>&)’
      /usr/include/c++/16/debug/safe_local_iterator.h:422:5:
        422 |     __valid_range(const _Safe_local_iterator<_Iterator, _UContainer>& __first,
            |     ^~~~~~~~~~~~~
      • template argument deduction/substitution failed:
        •   mismatched types ‘const __gnu_debug::_Safe_local_iterator<_Iterator, _Sequence>’ and ‘const unsigned char*’
          /usr/include/c++/16/span:196:11:
            196 |         { __glibcxx_requires_valid_range(__first, __last); }
                |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • candidate 7: ‘template<class _Iterator> constexpr bool __gnu_debug::__valid_range(const std::reverse_iterator<_IteratorL>&, const std::reverse_iterator<_IteratorL>&, typename _Distance_traits<_Iterator>::__type&)’
      /usr/include/c++/16/debug/stl_iterator.h:40:5:
         40 |     __valid_range(const std::reverse_iterator<_Iterator>& __first,
            |     ^~~~~~~~~~~~~
      • candidate expects 3 arguments, 2 provided
    • candidate 8: ‘template<class _Iterator> constexpr bool __gnu_debug::__valid_range(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&, typename _Distance_traits<_Iterator>::__type&)’
      /usr/include/c++/16/debug/stl_iterator.h:104:5:
        104 |     __valid_range(const std::move_iterator<_Iterator>& __first,
            |     ^~~~~~~~~~~~~
      • candidate expects 3 arguments, 2 provided
compilation terminated due to -fmax-errors=1.


  parent reply	other threads:[~2026-11-20 15:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 22:56 [PATCH v4 00/16] Rename gdb::array_view to gdb::span Tom Tromey
2026-11-18 22:56 ` [PATCH v4 01/16] Rename array_view files Tom Tromey
2026-11-18 22:56 ` [PATCH v4 02/16] Rename gdb::array_view to gdb::span Tom Tromey
2026-11-18 22:56 ` [PATCH v4 03/16] Rename gdb::make_array_view to gdb::make_span Tom Tromey
2026-11-18 22:56 ` [PATCH v4 04/16] Rename gdb_argv::as_array_view Tom Tromey
2026-11-18 22:56 ` [PATCH v4 05/16] Remove operator== and operator!= from gdb::span Tom Tromey
2026-11-18 22:56 ` [PATCH v4 06/16] Rename span::slice to span::subspan Tom Tromey
2026-11-18 22:56 ` [PATCH v4 07/16] Qualify calls to gdb::copy Tom Tromey
2026-11-18 22:56 ` [PATCH v4 08/16] Add single-argument overloads of process_options et al Tom Tromey
2026-11-18 22:56 ` [PATCH v4 09/16] Remove span from cli-option.c:build_help_option Tom Tromey
2026-11-18 22:56 ` [PATCH v4 10/16] gdb/unittests: use one static_assert per check in span-selftests.c Tom Tromey
2026-11-18 22:56 ` [PATCH v4 11/16] Don't use the single-argument gdb::span constructor Tom Tromey
2026-11-19  3:34   ` Simon Marchi
2026-11-19  3:42   ` Simon Marchi
2026-11-18 22:56 ` [PATCH v4 12/16] Don't turn rvalue reference into a span Tom Tromey
2026-11-19  3:50   ` Simon Marchi
2026-11-19 14:56     ` Tom Tromey
2026-11-18 22:56 ` [PATCH v4 13/16] Make gdb::span conform more closely to C++20 Tom Tromey
2026-11-18 22:56 ` [PATCH v4 14/16] Allow the use of C++20 std::ranges in gdbsupport/ranges.h Tom Tromey
2026-11-18 22:56 ` [PATCH v4 15/16] Allow the use of C++20 std::span in gdbsupport/span.h Tom Tromey
2026-11-19  3:52   ` Simon Marchi
2026-11-20 15:52   ` Jan Vrany [this message]
2026-11-20 20:15     ` Simon Marchi
2026-11-18 22:56 ` [PATCH v4 16/16] Move gdb::ranges::equal to gdbsupport/ranges.h Tom Tromey
2026-11-19  4:21 ` [PATCH v4 00/16] Rename gdb::array_view to gdb::span Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e87cf228454f373b9f1e70816b01db5225bfed8.camel@vrany.io \
    --to=jan@vrany.io \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox