From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 66C103840C0F; Sun, 28 Jun 2020 02:23:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66C103840C0F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593311036; bh=1Aubf2B8quQYpYliSEhATq+gvcTwDQybExw7Ym88OCQ=; h=From:To:Subject:Date:From; b=Lld8eDDc/htok4VCIxhj9tykqCy4oOkvxaJ4qZu1NjfMLtkzL0SOsV8HmxyhXjwzU dSOwyo1r+JpfYOPgUdMTa1oP++l9IYSmr4e2TiTFSSyj3MlilQ6ryXFL3ltQbHXhq6 YdFbZGIoN7dQgJ6ve7EKhL2HjiciXS9mBcvEkHLg= From: "barry.revzin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95944] New: Concept diagnostic has multiple copies of irrelevant type and displays correct type incorrectly Date: Sun, 28 Jun 2020 02:23:56 +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: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: barry.revzin at gmail dot com 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2020 02:23:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95944 Bug ID: 95944 Summary: Concept diagnostic has multiple copies of irrelevant type and displays correct type incorrectly Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider the following heavily reduced, and incorrect, attempt at an iterat= or: #include template struct range { struct iterator { using reference =3D T; using value_type =3D T; auto operator*() -> T; }; }; static_assert(std::indirectly_readable::iterator>); This fails to meet the requirements of indirectly_readable because operator= *() needs to be const. This is the diagnostic I get from gcc trunk: source>:13:20: error: static assertion failed 13 | static_assert(std::indirectly_readable::iterator>); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :13:20: note: constraints not satisfied In file included from /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/stl_iterator_base= _types.h:71, from /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/iterator:61, from /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/ranges:44, from :1: /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/iterator_concepts= .h:446:13: required for the satisfaction of '__indirectly_readable_impl::type>::type>' [with _Tp= =3D range::iterator] /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/iterator_concepts= .h:446:42: in requirements with 'const _In __in' [with _Tp =3D range::iterator<= int>; _Tp =3D range::iterator; _In =3D range::iterator] /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/iterator_concepts= .h:451:4: note: the required expression '* __in' is invalid 451 | { *__in } -> same_as>; | ^~~~~ /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/iterator_concepts= .h:452:21: note: the required expression 'std::ranges::__cust::iter_move(__in)' is inv= alid 452 | { ranges::iter_move(__in) } -> same_as>; | ~~~~~~~~~~~~~~~~~^~~~~~ cc1plus: note: set '-fconcepts-diagnostics-depth=3D' to at least 2 for more detail Compiler returned: 1 There are two especially important lines in this diagnostic: the one that indicates the failed expression and the one that indicates the type of it. = The one that indicates the types is this one: /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/iterator_concepts= .h:446:42: in requirements with 'const _In __in' [with _Tp =3D range::iterator<= int>; _Tp =3D range::iterator; _In =3D range::iterator] There is only one type in the requirement (_In) but the description starts = with some type _Tp. And then we get _Tp a second time, before finally getting to _In. _In is also displayed incorrectly: it is shown as range::iterator when it should be range::iterator. Ideally this line looks closer to: /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/iterator_concepts= .h:446:42: in requirements with 'const _In __in' [with _In =3D range::iterator]=