public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr
@ 2021-09-16  7:38 hewillk at gmail dot com
  2021-09-25 20:06 ` [Bug libstdc++/102358] " redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: hewillk at gmail dot com @ 2021-09-16  7:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102358
           Summary: niter_base and miter_base overloaded for move_iterator
                    missing constexpr
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

stl_iterator.h#L2416:

  template<typename _Iterator>
    auto
    __niter_base(move_iterator<_Iterator> __it)
    -> decltype(make_move_iterator(__niter_base(__it.base())))
    { return make_move_iterator(__niter_base(__it.base())); }

  template<typename _Iterator>
    auto
    __miter_base(move_iterator<_Iterator> __it)
    -> decltype(__miter_base(__it.base()))
    { return __miter_base(__it.base()); }

They seem to be missing constexpr:

#include <algorithm>
#include <array>

constexpr bool b = [] {
  std::array<int, 2> in{}, out{};
  std::move(std::move_iterator(in.begin()), std::move_iterator(in.end()),
out.begin());
  return true;
}();

https://godbolt.org/z/PTrTnxTnK

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
@ 2021-09-25 20:06 ` redi at gcc dot gnu.org
  2021-10-21 12:31 ` ppalka at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2021-09-25 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-09-25
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
  2021-09-25 20:06 ` [Bug libstdc++/102358] " redi at gcc dot gnu.org
@ 2021-10-21 12:31 ` ppalka at gcc dot gnu.org
  2021-10-21 16:13 ` cvs-commit at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-10-21 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
                 CC|                            |ppalka at gcc dot gnu.org

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
  2021-09-25 20:06 ` [Bug libstdc++/102358] " redi at gcc dot gnu.org
  2021-10-21 12:31 ` ppalka at gcc dot gnu.org
@ 2021-10-21 16:13 ` cvs-commit at gcc dot gnu.org
  2022-02-16 21:43 ` gcc at ebasoft dot com.pl
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-21 16:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:5f7976f65b45c457b57bfc2c55ec845771e0d3c2

commit r12-4617-g5f7976f65b45c457b57bfc2c55ec845771e0d3c2
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Oct 21 12:13:35 2021 -0400

    libstdc++: missing constexpr for __[nm]iter_base [PR102358]

            PR libstdc++/102358

    libstdc++-v3/ChangeLog:

            * include/bits/stl_iterator.h (__niter_base): Make constexpr
            for C++20.
            (__miter_base): Likewise.
            * testsuite/25_algorithms/move/constexpr.cc: New test.

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2021-10-21 16:13 ` cvs-commit at gcc dot gnu.org
@ 2022-02-16 21:43 ` gcc at ebasoft dot com.pl
  2022-02-17 10:29 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: gcc at ebasoft dot com.pl @ 2022-02-16 21:43 UTC (permalink / raw)
  To: gcc-bugs

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

Artur Bać <gcc at ebasoft dot com.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc at ebasoft dot com.pl

--- Comment #2 from Artur Bać <gcc at ebasoft dot com.pl> ---
I have spend 20min figuring out why std::copy fails compile at constexpr with
libstdc++ only ;-) and it is already reported.

"* include/bits/stl_iterator.h (__niter_base): Make constexpr for C++20."

c++20 ?
according to cppreference make_move_iterator is constexpr since c++17
https://en.cppreference.com/w/cpp/iterator/make_move_iterator

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2022-02-16 21:43 ` gcc at ebasoft dot com.pl
@ 2022-02-17 10:29 ` redi at gcc dot gnu.org
  2022-02-17 10:53 ` gcc at ebasoft dot com.pl
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2022-02-17 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Artur Bać from comment #2)
> "* include/bits/stl_iterator.h (__niter_base): Make constexpr for C++20."
> 
> c++20 ?
> according to cppreference make_move_iterator is constexpr since c++17
> https://en.cppreference.com/w/cpp/iterator/make_move_iterator

Yes, and that's what libstdc++ does. __niter_base is a different function.

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
                   ` (4 preceding siblings ...)
  2022-02-17 10:29 ` redi at gcc dot gnu.org
@ 2022-02-17 10:53 ` gcc at ebasoft dot com.pl
  2022-02-17 11:40 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: gcc at ebasoft dot com.pl @ 2022-02-17 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Artur Bać <gcc at ebasoft dot com.pl> ---
In 12 ?

In 11.2.1/include/g++-v11/bits/cpp_type_traits.h
 template<typename _Iterator>
    _GLIBCXX20_CONSTEXPR
    inline _Iterator
    __miter_base(_Iterator __it)

and as it was mentioned overload in stl_iterator.h has missing constexpr at
all.

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
                   ` (5 preceding siblings ...)
  2022-02-17 10:53 ` gcc at ebasoft dot com.pl
@ 2022-02-17 11:40 ` redi at gcc dot gnu.org
  2022-02-17 11:50 ` gcc at ebasoft dot com.pl
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2022-02-17 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I don't understand what you're saying. __miter_base is not make_move_iterator,
so what do you mean?

std::make_move_iterator is constexpr for C++17 and up. That's true in GCC 12
and in every release since GCC 7.1 because I added it in commit
r7-2774-g06db992005654e 

https://godbolt.org/z/W3qsnbvoE

Do you have code using std::make_move_iterator that fails to compile with GCC
12? If so, please show that code instead of whatever it is you're saying about
__miter_base and __niter_base, because those do not affect
std::make_move_iterator in any way.

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
                   ` (6 preceding siblings ...)
  2022-02-17 11:40 ` redi at gcc dot gnu.org
@ 2022-02-17 11:50 ` gcc at ebasoft dot com.pl
  2022-02-17 12:37 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: gcc at ebasoft dot com.pl @ 2022-02-17 11:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Artur Bać <gcc at ebasoft dot com.pl> ---
My bad. copy itself is constexpr since c++20, I was misleaded by overload used
for move_iterator with copy that has missing constexpr 

template<typename _Iterator>
auto __miter_base(move_iterator<_Iterator> __it)

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
                   ` (7 preceding siblings ...)
  2022-02-17 11:50 ` gcc at ebasoft dot com.pl
@ 2022-02-17 12:37 ` redi at gcc dot gnu.org
  2022-02-17 13:03 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2022-02-17 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.4

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
OK, thanks for clarifying.

Patrick, please backport this to gcc-10 and gcc-11 at some point.

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
                   ` (8 preceding siblings ...)
  2022-02-17 12:37 ` redi at gcc dot gnu.org
@ 2022-02-17 13:03 ` cvs-commit at gcc dot gnu.org
  2022-02-17 13:04 ` cvs-commit at gcc dot gnu.org
  2022-02-17 13:06 ` ppalka at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-17 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:973e0bc1542dd5efc501fef8653d47c9b00adf97

commit r11-9588-g973e0bc1542dd5efc501fef8653d47c9b00adf97
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Oct 21 12:13:35 2021 -0400

    libstdc++: missing constexpr for __[nm]iter_base [PR102358]

            PR libstdc++/102358

    libstdc++-v3/ChangeLog:

            * include/bits/stl_iterator.h (__niter_base): Make constexpr
            for C++20.
            (__miter_base): Likewise.
            * testsuite/25_algorithms/move/constexpr.cc: New test.

    (cherry picked from commit 5f7976f65b45c457b57bfc2c55ec845771e0d3c2)

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
                   ` (9 preceding siblings ...)
  2022-02-17 13:03 ` cvs-commit at gcc dot gnu.org
@ 2022-02-17 13:04 ` cvs-commit at gcc dot gnu.org
  2022-02-17 13:06 ` ppalka at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-17 13:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:f9982b5a81a151663c76ba0a3fb6df674f29ba4b

commit r10-10466-gf9982b5a81a151663c76ba0a3fb6df674f29ba4b
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Oct 21 12:13:35 2021 -0400

    libstdc++: missing constexpr for __[nm]iter_base [PR102358]

            PR libstdc++/102358

    libstdc++-v3/ChangeLog:

            * include/bits/stl_iterator.h (__niter_base): Make constexpr
            for C++20.
            (__miter_base): Likewise.
            * testsuite/25_algorithms/move/constexpr.cc: New test.

    (cherry picked from commit 5f7976f65b45c457b57bfc2c55ec845771e0d3c2)

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

* [Bug libstdc++/102358] niter_base and miter_base overloaded for move_iterator missing constexpr
  2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
                   ` (10 preceding siblings ...)
  2022-02-17 13:04 ` cvs-commit at gcc dot gnu.org
@ 2022-02-17 13:06 ` ppalka at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-02-17 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for 10.4/11.3/12.

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

end of thread, other threads:[~2022-02-17 13:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16  7:38 [Bug libstdc++/102358] New: niter_base and miter_base overloaded for move_iterator missing constexpr hewillk at gmail dot com
2021-09-25 20:06 ` [Bug libstdc++/102358] " redi at gcc dot gnu.org
2021-10-21 12:31 ` ppalka at gcc dot gnu.org
2021-10-21 16:13 ` cvs-commit at gcc dot gnu.org
2022-02-16 21:43 ` gcc at ebasoft dot com.pl
2022-02-17 10:29 ` redi at gcc dot gnu.org
2022-02-17 10:53 ` gcc at ebasoft dot com.pl
2022-02-17 11:40 ` redi at gcc dot gnu.org
2022-02-17 11:50 ` gcc at ebasoft dot com.pl
2022-02-17 12:37 ` redi at gcc dot gnu.org
2022-02-17 13:03 ` cvs-commit at gcc dot gnu.org
2022-02-17 13:04 ` cvs-commit at gcc dot gnu.org
2022-02-17 13:06 ` 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).