public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/108760] New: ranges::iota is not included in <numeric>
@ 2023-02-11  6:27 hewillk at gmail dot com
  2023-02-11 16:42 ` [Bug libstdc++/108760] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hewillk at gmail dot com @ 2023-02-11  6:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108760
           Summary: ranges::iota is not included in <numeric>
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

It seems wrong that libstdc++ needs to include <algorithm> for ranges::iota.


#include <numeric>

int main() {
  int x[] = {0, 0, 0, 0, 0};
  std::ranges::iota(x, 0);
}

https://godbolt.org/z/33EPeqd1b

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

* [Bug libstdc++/108760] ranges::iota is not included in <numeric>
  2023-02-11  6:27 [Bug libstdc++/108760] New: ranges::iota is not included in <numeric> hewillk at gmail dot com
@ 2023-02-11 16:42 ` redi at gcc dot gnu.org
  2023-08-06 18:00 ` daniel.kruegler at googlemail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-11 16:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-02-11
                 CC|                            |ppalka at gcc dot gnu.org

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

* [Bug libstdc++/108760] ranges::iota is not included in <numeric>
  2023-02-11  6:27 [Bug libstdc++/108760] New: ranges::iota is not included in <numeric> hewillk at gmail dot com
  2023-02-11 16:42 ` [Bug libstdc++/108760] " redi at gcc dot gnu.org
@ 2023-08-06 18:00 ` daniel.kruegler at googlemail dot com
  2024-01-10 18:34 ` mlevine55 at bloomberg dot net
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2023-08-06 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to 康桓瑋 from comment #0)
> It seems wrong that libstdc++ needs to include <algorithm> for ranges::iota.

I agree, this looks like a defect, both std::iota and std::ranges:iota are
specified to be part of header <numerics>

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

* [Bug libstdc++/108760] ranges::iota is not included in <numeric>
  2023-02-11  6:27 [Bug libstdc++/108760] New: ranges::iota is not included in <numeric> hewillk at gmail dot com
  2023-02-11 16:42 ` [Bug libstdc++/108760] " redi at gcc dot gnu.org
  2023-08-06 18:00 ` daniel.kruegler at googlemail dot com
@ 2024-01-10 18:34 ` mlevine55 at bloomberg dot net
  2024-01-10 19:08 ` daniel.kruegler at googlemail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mlevine55 at bloomberg dot net @ 2024-01-10 18:34 UTC (permalink / raw)
  To: gcc-bugs

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

Michael Levine <mlevine55 at bloomberg dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mlevine55 at bloomberg dot net

--- Comment #2 from Michael Levine <mlevine55 at bloomberg dot net> ---
(In reply to Daniel Krügler from comment #1)
> (In reply to 康桓瑋 from comment #0)
> > It seems wrong that libstdc++ needs to include <algorithm> for ranges::iota.
> 
> I agree, this looks like a defect, both std::iota and std::ranges:iota are
> specified to be part of header <numerics>

Should it not require including <algorithm> even though it seems to be a use of
a constrained algorithm through C++20 that is in the namespace std::ranges? 
https://en.cppreference.com/w/cpp/algorithm

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

* [Bug libstdc++/108760] ranges::iota is not included in <numeric>
  2023-02-11  6:27 [Bug libstdc++/108760] New: ranges::iota is not included in <numeric> hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2024-01-10 18:34 ` mlevine55 at bloomberg dot net
@ 2024-01-10 19:08 ` daniel.kruegler at googlemail dot com
  2024-01-11  0:12 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2024-01-10 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Michael Levine from comment #2)
> (In reply to Daniel Krügler from comment #1)
> > (In reply to 康桓瑋 from comment #0)
> > > It seems wrong that libstdc++ needs to include <algorithm> for ranges::iota.
> > 
> > I agree, this looks like a defect, both std::iota and std::ranges:iota are
> > specified to be part of header <numerics>
> 
> Should it not require including <algorithm> even though it seems to be a use
> of a constrained algorithm through C++20 that is in the namespace
> std::ranges?  https://en.cppreference.com/w/cpp/algorithm

Following https://cplusplus.github.io/LWG/lwg-defects.html#1178 we have
according to [res.on.headers] p1

"A C++ header shall provide the declarations and definitions that appear in its
synopsis."

and I'm interpreting this that an implementation needs to make it work without
requiring the user to include <algorithm>.

But we have https://cplusplus.github.io/LWG/issue3679 which raises a similar
question for a different issue. If the libstdc++ maintainers think that the
current wording does require a conforming program to include <algorithm>, I
think that an LWG issue would be required.

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

* [Bug libstdc++/108760] ranges::iota is not included in <numeric>
  2023-02-11  6:27 [Bug libstdc++/108760] New: ranges::iota is not included in <numeric> hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2024-01-10 19:08 ` daniel.kruegler at googlemail dot com
@ 2024-01-11  0:12 ` redi at gcc dot gnu.org
  2024-04-17 18:32 ` mlevine55 at bloomberg dot net
  2024-06-08 14:53 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-11  0:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Michael Levine from comment #2)
> Should it not require including <algorithm>

No, I don't see why. It's specified to be in <numerics>.

This looks like a simple bug, that's all.

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

* [Bug libstdc++/108760] ranges::iota is not included in <numeric>
  2023-02-11  6:27 [Bug libstdc++/108760] New: ranges::iota is not included in <numeric> hewillk at gmail dot com
                   ` (4 preceding siblings ...)
  2024-01-11  0:12 ` redi at gcc dot gnu.org
@ 2024-04-17 18:32 ` mlevine55 at bloomberg dot net
  2024-06-08 14:53 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mlevine55 at bloomberg dot net @ 2024-04-17 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Michael Levine <mlevine55 at bloomberg dot net> ---
I submitted a patch for this today, see either the gcc-patches or the libstdc++
mailing lists for the subject:  [PATCH] libstdc++: Fix std::ranges::iota is not
included in numeric [PR108760]

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

* [Bug libstdc++/108760] ranges::iota is not included in <numeric>
  2023-02-11  6:27 [Bug libstdc++/108760] New: ranges::iota is not included in <numeric> hewillk at gmail dot com
                   ` (5 preceding siblings ...)
  2024-04-17 18:32 ` mlevine55 at bloomberg dot net
@ 2024-06-08 14:53 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-08 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:0bb1db32ccf54a9de59bea718f7575f7ef22abf5

commit r15-1117-g0bb1db32ccf54a9de59bea718f7575f7ef22abf5
Author: Michael Levine <mlevine55@bloomberg.net>
Date:   Fri Jun 7 09:54:38 2024 +0100

    libstdc++: Fix std::ranges::iota is not included in numeric [PR108760]

    Before this patch, using std::ranges::iota required including
    <algorithm> when it should have been sufficient to only include
    <numeric>.

    libstdc++-v3/ChangeLog:

            PR libstdc++/108760
            * include/bits/ranges_algo.h (ranges::out_value_result):
            Move to <bits/ranges_algobase.h>.
            (ranges::iota_result, ranges::__iota_fn, ranges::iota): Move to
            <numeric>.
            * include/bits/ranges_algobase.h (ranges::out_value_result):
            Move to here.
            * include/std/numeric (ranges::iota_result, ranges::__iota_fn)
            (ranges::iota): Move to here.
            * testsuite/25_algorithms/iota/1.cc: Renamed to ...
            * testsuite/26_numerics/iota/2.cc: ... here.

    Signed-off-by: Michael Levine <mlevine55@bloomberg.net>

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

end of thread, other threads:[~2024-06-08 14:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-11  6:27 [Bug libstdc++/108760] New: ranges::iota is not included in <numeric> hewillk at gmail dot com
2023-02-11 16:42 ` [Bug libstdc++/108760] " redi at gcc dot gnu.org
2023-08-06 18:00 ` daniel.kruegler at googlemail dot com
2024-01-10 18:34 ` mlevine55 at bloomberg dot net
2024-01-10 19:08 ` daniel.kruegler at googlemail dot com
2024-01-11  0:12 ` redi at gcc dot gnu.org
2024-04-17 18:32 ` mlevine55 at bloomberg dot net
2024-06-08 14:53 ` cvs-commit 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).