public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95944] New: Concept diagnostic has multiple copies of irrelevant type and displays correct type incorrectly
@ 2020-06-28  2:23 barry.revzin at gmail dot com
  2020-06-28  7:57 ` [Bug c++/95944] " ensadc at mailnesia dot com
  2020-06-29 12:54 ` ppalka at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: barry.revzin at gmail dot com @ 2020-06-28  2:23 UTC (permalink / raw)
  To: gcc-bugs

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

            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 iterator:

#include <ranges>

template <typename T>
struct range {
    struct iterator {
        using reference = T;
        using value_type = T;

        auto operator*() -> T;
    };
};

static_assert(std::indirectly_readable<range<int>::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<range<int>::iterator>);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>: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 <source>: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<typename
std::remove_cv<typename std::remove_reference<_Tp>::type>::type>' [with _Tp =
range<int>::iterator<int>]
/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 = range<int>::iterator<int>;
_Tp = range<int>::iterator<int>; _In = range<int>::iterator<int>]
/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<iter_reference_t<_In>>;
      |    ^~~~~
/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 invalid
  452 |  { ranges::iter_move(__in) } -> same_as<iter_rvalue_reference_t<_In>>;
      |    ~~~~~~~~~~~~~~~~~^~~~~~
cc1plus: note: set '-fconcepts-diagnostics-depth=' 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 = range<int>::iterator<int>;
_Tp = range<int>::iterator<int>; _In = range<int>::iterator<int>]

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<int>::iterator<int> when it should be range<int>::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 = range<int>::iterator]

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

* [Bug c++/95944] Concept diagnostic has multiple copies of irrelevant type and displays correct type incorrectly
  2020-06-28  2:23 [Bug c++/95944] New: Concept diagnostic has multiple copies of irrelevant type and displays correct type incorrectly barry.revzin at gmail dot com
@ 2020-06-28  7:57 ` ensadc at mailnesia dot com
  2020-06-29 12:54 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ensadc at mailnesia dot com @ 2020-06-28  7:57 UTC (permalink / raw)
  To: gcc-bugs

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

ensadc at mailnesia dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ensadc at mailnesia dot com

--- Comment #1 from ensadc at mailnesia dot com ---
bug95303, bug95310

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

* [Bug c++/95944] Concept diagnostic has multiple copies of irrelevant type and displays correct type incorrectly
  2020-06-28  2:23 [Bug c++/95944] New: Concept diagnostic has multiple copies of irrelevant type and displays correct type incorrectly barry.revzin at gmail dot com
  2020-06-28  7:57 ` [Bug c++/95944] " ensadc at mailnesia dot com
@ 2020-06-29 12:54 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-06-29 12:54 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-06-29
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2020-06-29 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28  2:23 [Bug c++/95944] New: Concept diagnostic has multiple copies of irrelevant type and displays correct type incorrectly barry.revzin at gmail dot com
2020-06-28  7:57 ` [Bug c++/95944] " ensadc at mailnesia dot com
2020-06-29 12:54 ` ppalka 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).