From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 768A83858C39; Fri, 13 Jan 2023 13:58:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 768A83858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673618305; bh=gRI7+Ea033kHDJcTSd1pzBq2M2yrSi+q9RDO/tRz7uY=; h=From:To:Subject:Date:From; b=HsHBBRstHPurYfpIqki1laD+BjZLUvRSihC5G8dYROxTY4VhBQPKSfJ72ueE6B5md vOfCvvE8dj8M/JxrzFupFkmRTiFJrzqWjHeANqrz9mBYb8lKM+0/qtu74kRdAt9VCR dOHw+weLMsbAVaY2Ico6Bfc1xgXiK6hwk8xrpkag= From: "nikolasklauser at berlin dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108393] New: circular concept false-positive Date: Fri, 13 Jan 2023 13:58:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nikolasklauser at berlin dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108393 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 requi= res=20 C<_Iter> constexpr bool operator=3D=3D(unreachable_sentinel_t, const _Iter&= ) [with _Iter =3D S]': ./equality_comparable.cpp:6:41: required by substitution of 'template requires requires(T __t, T __u) {__t =3D=3D __u;} struct iterator_trait= s [with T =3D S]' ./equality_comparable.cpp:11:33: required from here ./equality_comparable.cpp:11:9: required for the satisfaction of 'C<_Iter= >' [with _Iter =3D S] ./equality_comparable.cpp:11:13: in requirements [with T =3D S] ./equality_comparable.cpp:11:13: error: satisfaction of atomic constraint 'requires{typename iterator_traits::A;} [with T =3D T]' depends on itself 11 | concept C =3D requires { typename iterator_traits::A; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./equality_comparable.cpp: In substitution of 'template requi= res=20 C<_Iter> constexpr bool operator=3D=3D(unreachable_sentinel_t, const _Iter&= ) [with _Iter =3D S]': ./equality_comparable.cpp:6:41: required by substitution of 'template requires requires(T __t, T __u) {__t =3D=3D __u;} struct iterator_trait= s [with T =3D S]' ./equality_comparable.cpp:11:33: required from here ./equality_comparable.cpp:11:9: required for the satisfaction of 'C<_Iter= >' [with _Iter =3D S] ./equality_comparable.cpp:11:13: in requirements [with T =3D S] ./equality_comparable.cpp:11:13: error: satisfaction of atomic constraint 'requires{typename iterator_traits::A;} [with T =3D T]' depends on itself But AFAICT this code should compile just fine. iterator_traits 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 struct iterator_traits {}; template requires requires(T __t, T __u) { __t =3D=3D __u; } struct iterator_traits {}; template concept C =3D requires { typename iterator_traits::A; }; struct unreachable_sentinel_t { template friend constexpr bool operator=3D=3D(unreachable_sentinel_t, const _Iter&) noexcept; }; template struct S {}; static_assert(!C>);=