public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nikolasklauser at berlin dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108393] New: circular concept false-positive Date: Fri, 13 Jan 2023 13:58:25 +0000 [thread overview] Message-ID: <bug-108393-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108393 Bug ID: 108393 Summary: circular concept false-positive Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nikolasklauser at berlin dot de Target Milestone: --- GCC errors on the reproducer below with ./equality_comparable.cpp: In substitution of 'template<class _Iter> requires C<_Iter> constexpr bool operator==(unreachable_sentinel_t, const _Iter&) [with _Iter = S<unreachable_sentinel_t>]': ./equality_comparable.cpp:6:41: required by substitution of 'template<class T> requires requires(T __t, T __u) {__t == __u;} struct iterator_traits<T> [with T = S<unreachable_sentinel_t>]' ./equality_comparable.cpp:11:33: required from here ./equality_comparable.cpp:11:9: required for the satisfaction of 'C<_Iter>' [with _Iter = S<unreachable_sentinel_t>] ./equality_comparable.cpp:11:13: in requirements [with T = S<unreachable_sentinel_t>] ./equality_comparable.cpp:11:13: error: satisfaction of atomic constraint 'requires{typename iterator_traits<T>::A;} [with T = T]' depends on itself 11 | concept C = requires { typename iterator_traits<T>::A; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./equality_comparable.cpp: In substitution of 'template<class _Iter> requires C<_Iter> constexpr bool operator==(unreachable_sentinel_t, const _Iter&) [with _Iter = S<unreachable_sentinel_t>]': ./equality_comparable.cpp:6:41: required by substitution of 'template<class T> requires requires(T __t, T __u) {__t == __u;} struct iterator_traits<T> [with T = S<unreachable_sentinel_t>]' ./equality_comparable.cpp:11:33: required from here ./equality_comparable.cpp:11:9: required for the satisfaction of 'C<_Iter>' [with _Iter = S<unreachable_sentinel_t>] ./equality_comparable.cpp:11:13: in requirements [with T = S<unreachable_sentinel_t>] ./equality_comparable.cpp:11:13: error: satisfaction of atomic constraint 'requires{typename iterator_traits<T>::A;} [with T = T]' depends on itself But AFAICT this code should compile just fine. iterator_traits<unreachable_sentinel_t> should never get instantiated and I don't see another way this would result in a self-reference. reproducer (Godbolt: https://godbolt.org/z/cfP5fqcMc): template<class> struct iterator_traits {}; template<class T> requires requires(T __t, T __u) { __t == __u; } struct iterator_traits<T> {}; template<class T> concept C = requires { typename iterator_traits<T>::A; }; struct unreachable_sentinel_t { template<C _Iter> friend constexpr bool operator==(unreachable_sentinel_t, const _Iter&) noexcept; }; template<class T> struct S {}; static_assert(!C<S<unreachable_sentinel_t>>);
next reply other threads:[~2023-01-13 13:58 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-13 13:58 nikolasklauser at berlin dot de [this message] 2023-01-13 16:09 ` [Bug c++/108393] " redi at gcc dot gnu.org 2023-01-13 16:15 ` redi at gcc dot gnu.org 2023-01-13 16:28 ` ppalka at gcc dot gnu.org 2023-01-27 17:02 ` pinskia at gcc dot gnu.org 2023-05-19 3:34 ` pinskia at gcc dot gnu.org 2024-03-09 15:37 ` ppalka 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-108393-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).