public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hewillk at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/106376] New: The implementation of std::pointer_traits seems wrong Date: Thu, 21 Jul 2022 03:56:52 +0000 [thread overview] Message-ID: <bug-106376-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106376 Bug ID: 106376 Summary: The implementation of std::pointer_traits seems wrong Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: hewillk at gmail dot com Target Milestone: --- [pointer.traits.types]: using element_type = see below; Type: Ptr::element_type if the qualified-id Ptr::element_type is valid and denotes a type ([temp.deduct]); otherwise, T if Ptr is a class template instantiation of the form SomePointer<T, Args>, where Args is zero or more type arguments; otherwise, the specialization is *ill-formed*. So for the following, the instantiation of pointer_traits will be ill-formed, and static_assert will cause a hard error, just like libc++ and MSVC-STL do. libstdc++ specifies element_type as a meaningless type, so the static_assert still passes. Although the behavior of libstdc++ is incorrect, but I am not feel good about this static_assert hard error.. #include <iterator> struct I { using iterator_category = std::contiguous_iterator_tag; using difference_type = std::ptrdiff_t; using value_type = int; value_type& operator*() const; I& operator++(); I operator++(int); I& operator--(); I operator--(int); I& operator+=(difference_type); I& operator-=(difference_type); value_type* operator->() const; value_type& operator[](difference_type) const; friend I operator+(I, difference_type); friend I operator+(difference_type, I); friend I operator-(I, difference_type); friend difference_type operator-(I, I); auto operator<=>(const I&) const = default; }; static_assert(std::contiguous_iterator<I>); https://godbolt.org/z/sx763oMn6
next reply other threads:[~2022-07-21 3:56 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-21 3:56 hewillk at gmail dot com [this message] 2022-07-21 4:09 ` [Bug libstdc++/106376] " hewillk at gmail dot com 2022-07-21 9:06 ` [Bug libstdc++/106376] [LWG3545] " redi at gcc dot gnu.org 2023-04-26 21:47 ` redi at gcc dot gnu.org
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=bug-106376-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).