public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114135] New: Diagnostic missing useful information for ranges code
@ 2024-02-27 16:53 barry.revzin at gmail dot com
2024-02-27 17:49 ` [Bug c++/114135] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: barry.revzin at gmail dot com @ 2024-02-27 16:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114135
Bug ID: 114135
Summary: Diagnostic missing useful information for ranges code
Product: gcc
Version: 13.1.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: ---
This is an example using Ranges:
#include <algorithm>
#include <ranges>
using namespace std;
int main() {
auto rng = views::iota(0, 3);
const auto [a, b] = * ranges::min_element(views::cartesian_product(rng,
rng));
return 0;
}
This is an ill-formed program, the error given by gcc trunk is:
<source>:7:25: error: no match for 'operator*' (operand type is
'std::ranges::borrowed_iterator_t<std::ranges::cartesian_product_view<std::ranges::iota_view<int,
int>, std::ranges::iota_view<int, int> > >')
7 | const auto [a, b] = *
ranges::min_element(views::cartesian_product(rng, rng));
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is all correct. However, it would be more helpful in this case for the
reader to also note that the type
std::ranges::borrowed_iterator_t<that_whole_thing> is actually the type
std::ranges::dangling. Seeing "dangling" in the error message makes it a lot
easier to understand what the issue here actually is.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/114135] Diagnostic missing useful information for ranges code
2024-02-27 16:53 [Bug c++/114135] New: Diagnostic missing useful information for ranges code barry.revzin at gmail dot com
@ 2024-02-27 17:49 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2024-02-27 17:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114135
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Keywords| |diagnostic
Ever confirmed|0 |1
Last reconfirmed| |2024-02-27
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Huh, I'd expect an "a.k.a 'std:ranges::dangling'" there.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-27 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 16:53 [Bug c++/114135] New: Diagnostic missing useful information for ranges code barry.revzin at gmail dot com
2024-02-27 17:49 ` [Bug c++/114135] " redi 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).