public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/96416] New: address_of() is broken by static_assert in pointer_traits
@ 2020-08-02  4:17 whatwasthataddress at gmail dot com
  2020-08-03 12:58 ` [Bug libstdc++/96416] " redi at gcc dot gnu.org
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: whatwasthataddress at gmail dot com @ 2020-08-02  4:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96416

            Bug ID: 96416
           Summary: address_of() is broken by static_assert in
                    pointer_traits
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: whatwasthataddress at gmail dot com
  Target Milestone: ---

pointer_traits contains this static_assert:

      static_assert(!is_same<element_type, __undefined>::value,
          "pointer type defines element_type or is like SomePointer<T, Args>");

When trying to use address_of() with an iterator that has a usable
operator->(), address_of() fails because the static_assert causes a hard error
in the trailing decltype here:

  template<typename _Ptr>
    constexpr auto
    __to_address(const _Ptr& __ptr) noexcept
    -> decltype(std::pointer_traits<_Ptr>::to_address(__ptr))
    { return std::pointer_traits<_Ptr>::to_address(__ptr); }

  template<typename _Ptr, typename... _None>
    constexpr auto
    __to_address(const _Ptr& __ptr, _None...) noexcept
    {
      if constexpr (is_base_of_v<__gnu_debug::_Safe_iterator_base, _Ptr>)
        return std::__to_address(__ptr.base().operator->());
      else
        return std::__to_address(__ptr.operator->());
    }

When I comment out the static_assert, to_address() works with the iterator in
question.

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2023-07-07  9:00 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02  4:17 [Bug libstdc++/96416] New: address_of() is broken by static_assert in pointer_traits whatwasthataddress at gmail dot com
2020-08-03 12:58 ` [Bug libstdc++/96416] " redi at gcc dot gnu.org
2020-08-03 15:34 ` whatwasthataddress at gmail dot com
2020-08-03 15:38 ` redi at gcc dot gnu.org
2020-11-11 17:46 ` redi at gcc dot gnu.org
2020-11-11 18:52 ` redi at gcc dot gnu.org
2020-11-11 19:10 ` redi at gcc dot gnu.org
2020-11-11 20:05 ` glenjofe at gmail dot com
2020-11-11 20:40 ` redi at gcc dot gnu.org
2020-11-11 20:41 ` redi at gcc dot gnu.org
2021-03-26 14:19 ` dangelog at gmail dot com
2021-03-26 14:45 ` dangelog at gmail dot com
2021-03-26 23:44 ` glenjofe at gmail dot com
2021-03-27  0:48 ` [Bug libstdc++/96416] to_address() " redi at gcc dot gnu.org
2021-03-27  1:41 ` arthur.j.odwyer at gmail dot com
2021-03-27 16:53 ` dangelog at gmail dot com
2021-03-27 19:46 ` redi at gcc dot gnu.org
2021-03-29  3:08 ` glenjofe at gmail dot com
2021-04-20 20:11 ` redi at gcc dot gnu.org
2021-04-21  8:45 ` dangelog at gmail dot com
2021-08-05 22:55 ` gcc-bugs at marehr dot dialup.fu-berlin.de
2021-09-28 14:00 ` [Bug libstdc++/96416] [DR 3545] " redi at gcc dot gnu.org
2021-11-25 23:12 ` cvs-commit at gcc dot gnu.org
2021-11-26 17:46 ` cvs-commit at gcc dot gnu.org
2021-11-26 17:52 ` redi at gcc dot gnu.org
2021-12-09  1:24 ` whatwasthataddress at gmail dot com
2022-06-28 10:41 ` jakub at gcc dot gnu.org
2023-07-07  9:00 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).