public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/97120] New: circular concept loops in <ranges>
@ 2020-09-19 15:34 avi@cloudius-systems.com
2020-09-19 23:26 ` [Bug libstdc++/97120] " rs2740 at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: avi@cloudius-systems.com @ 2020-09-19 15:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97120
Bug ID: 97120
Summary: circular concept loops in <ranges>
Product: gcc
Version: 10.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: avi@cloudius-systems.com
Target Milestone: ---
The following example compiles with gcc and fails with clang. I believe clang
is correct but can't prove it.
======= begin example =============
#include <ranges>
void foo() {
std::ranges::iota_view iota(2, 10);
iota.begin();
}
======== end example ==============
Clang complains that iota_view doesn't have a begin() member (which it does). I
think the reason is that the constraint is evaluated before iota_view is fully
defined. gcc evaluates lazily so it doesn't stumble on the problem.
The circular chain is:
view_interface<iota_view> is instantiated as a base class of iota_view. Clearly
iota_view isn't defined at this stage, it's just a forward-declared name.
view_interface instantiates iterator_t, which is an alias to
std::__detail::__range_iter_t.
__range_iter_t instantiates __ranges_begin.
__ranges_begin requires that its template parameter is a __member_begin<>
(among other options, but this is the valid one here).
__member_begin requires that the type (iota_view) have a begin() function. But
the type isn't defined yet.
I believe clang is correct, mostly because I believe concept evaluation should
be eager and not lazy, not because I know it for a fact.
Apologies for posting a clang issue here, I wouldn't if gcc could get
asan+coroutines working. The problem will hit gcc if it implements eager
evaluation too.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/97120] circular concept loops in <ranges>
2020-09-19 15:34 [Bug libstdc++/97120] New: circular concept loops in <ranges> avi@cloudius-systems.com
@ 2020-09-19 23:26 ` rs2740 at gmail dot com
2020-09-20 5:27 ` avi@cloudius-systems.com
2021-11-23 17:05 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rs2740 at gmail dot com @ 2020-09-19 23:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97120
TC <rs2740 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rs2740 at gmail dot com
--- Comment #1 from TC <rs2740 at gmail dot com> ---
Concept evaluation is lazy, not eager. See [temp.inst]/18.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/97120] circular concept loops in <ranges>
2020-09-19 15:34 [Bug libstdc++/97120] New: circular concept loops in <ranges> avi@cloudius-systems.com
2020-09-19 23:26 ` [Bug libstdc++/97120] " rs2740 at gmail dot com
@ 2020-09-20 5:27 ` avi@cloudius-systems.com
2021-11-23 17:05 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: avi@cloudius-systems.com @ 2020-09-20 5:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97120
--- Comment #2 from Avi Kivity <avi@cloudius-systems.com> ---
This makes sense, according to my very limited ability to understand the
standard. I reflected it to the clang bug here:
https://bugs.llvm.org/show_bug.cgi?id=47509.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/97120] circular concept loops in <ranges>
2020-09-19 15:34 [Bug libstdc++/97120] New: circular concept loops in <ranges> avi@cloudius-systems.com
2020-09-19 23:26 ` [Bug libstdc++/97120] " rs2740 at gmail dot com
2020-09-20 5:27 ` avi@cloudius-systems.com
@ 2021-11-23 17:05 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-23 17:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97120
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |MOVED
Status|UNCONFIRMED |RESOLVED
See Also| |https://bugs.llvm.org/show_
| |bug.cgi?id=47509
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is a clang bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-23 17:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19 15:34 [Bug libstdc++/97120] New: circular concept loops in <ranges> avi@cloudius-systems.com
2020-09-19 23:26 ` [Bug libstdc++/97120] " rs2740 at gmail dot com
2020-09-20 5:27 ` avi@cloudius-systems.com
2021-11-23 17:05 ` 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).