public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&)
@ 2021-10-31  9:48 andrey.davydov at jetbrains dot com
  2021-10-31  9:50 ` [Bug libstdc++/103013] " andrey.davydov at jetbrains dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: andrey.davydov at jetbrains dot com @ 2021-10-31  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103013
           Summary: Underconstrained constructor span(_Range&&)
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrey.davydov at jetbrains dot com
  Target Milestone: ---

During calculation of type trait `is_move_constructible<span>` span constructor
from `_Range &&` is checked and concept `contiguous_range<span<T>>`
instantiated. It requires T to be complete type
(https://gcc.godbolt.org/z/fYWa3KdTs). It means that
`optional<span<Incomplete>>` couldn't be instantiated
(https://gcc.godbolt.org/z/1PWdE4YK3).

This issue could be solved if make the constructor span(_Range&&) more
constrained, something like this:
template<typename _Range>
  requires (!__is_same(_Range, span)) && ...
span(_Range&& __range);

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
@ 2021-10-31  9:50 ` andrey.davydov at jetbrains dot com
  2021-10-31 18:11 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: andrey.davydov at jetbrains dot com @ 2021-10-31  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrey <andrey.davydov at jetbrains dot com> ---
Sorry, the first link to godbolt in the starter message is wrong, it should be
https://gcc.godbolt.org/z/jWeqs6cM4.

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
  2021-10-31  9:50 ` [Bug libstdc++/103013] " andrey.davydov at jetbrains dot com
@ 2021-10-31 18:11 ` redi at gcc dot gnu.org
  2021-10-31 18:13 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-31 18:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
According to the standard, span<Incomplete> is undefined behaviour, see the
last bullet of [res.on.functions].

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
  2021-10-31  9:50 ` [Bug libstdc++/103013] " andrey.davydov at jetbrains dot com
  2021-10-31 18:11 ` redi at gcc dot gnu.org
@ 2021-10-31 18:13 ` redi at gcc dot gnu.org
  2021-11-01  3:12 ` rs2740 at gmail dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-31 18:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And libstdc++ has exactly the constraints required by the C++ draft. I suggest
reporting this as an LWG defect.

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
                   ` (2 preceding siblings ...)
  2021-10-31 18:13 ` redi at gcc dot gnu.org
@ 2021-11-01  3:12 ` rs2740 at gmail dot com
  2021-11-01  5:23 ` andrey.davydov at jetbrains dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rs2740 at gmail dot com @ 2021-11-01  3:12 UTC (permalink / raw)
  To: gcc-bugs

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

TC <rs2740 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rs2740 at gmail dot com

--- Comment #4 from TC <rs2740 at gmail dot com> ---
I don't think this needs an extra constraint, just reordering the existing ones
to check not-a-span (14.3, "remove_­cvref_­t<R> is not a specialization of
span") first.

But this is very much undefined anyway.

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
                   ` (3 preceding siblings ...)
  2021-11-01  3:12 ` rs2740 at gmail dot com
@ 2021-11-01  5:23 ` andrey.davydov at jetbrains dot com
  2021-11-01 11:32 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: andrey.davydov at jetbrains dot com @ 2021-11-01  5:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrey <andrey.davydov at jetbrains dot com> ---
Sorry, my fault, span<Incomplete is explicitly forbidden:
https://eel.is/c++draft/views.span#span.overview-4. It looks strange for me,
but of course, it's not a topic for this tracker.

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
                   ` (4 preceding siblings ...)
  2021-11-01  5:23 ` andrey.davydov at jetbrains dot com
@ 2021-11-01 11:32 ` redi at gcc dot gnu.org
  2021-11-01 23:51 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-01 11:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-01
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to TC from comment #4)
> I don't think this needs an extra constraint, just reordering the existing
> ones to check not-a-span (14.3, "remove_­cvref_­t<R> is not a specialization
> of span") first.

Good point - we should do that just because it's cheaper to evaluate the
!is_span check before we waste time determining if it's a contiguous range.

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
                   ` (5 preceding siblings ...)
  2021-11-01 11:32 ` redi at gcc dot gnu.org
@ 2021-11-01 23:51 ` cvs-commit at gcc dot gnu.org
  2021-11-01 23:54 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-01 23:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS 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:09bc98098e4ad474d2ba9da52457b29bbd08874b

commit r12-4833-g09bc98098e4ad474d2ba9da52457b29bbd08874b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 1 11:32:39 2021 +0000

    libstdc++: Reorder constraints on std::span::span(Range&&) constructor.

    In PR libstdc++/103013 Tim Song pointed out that we could reorder the
    constraints of this constructor. That's worth doing just to reduce the
    work the compiler has to do during overload resolution, even if it isn't
    needed to make the code in the PR work.

    libstdc++-v3/ChangeLog:

            * include/std/span (span(Range&&)): Reorder constraints.

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
                   ` (6 preceding siblings ...)
  2021-11-01 23:51 ` cvs-commit at gcc dot gnu.org
@ 2021-11-01 23:54 ` redi at gcc dot gnu.org
  2022-04-21 12:33 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-01 23:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Done.

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
                   ` (7 preceding siblings ...)
  2021-11-01 23:54 ` redi at gcc dot gnu.org
@ 2022-04-21 12:33 ` cvs-commit at gcc dot gnu.org
  2022-04-26 13:13 ` cvs-commit at gcc dot gnu.org
  2022-04-26 13:21 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-21 12:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:2b0ddcec0e4cc46852e0a4dd7d00307d46233ec0

commit r11-9911-g2b0ddcec0e4cc46852e0a4dd7d00307d46233ec0
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 1 11:32:39 2021 +0000

    libstdc++: Reorder constraints on std::span::span(Range&&) constructor.

    In PR libstdc++/103013 Tim Song pointed out that we could reorder the
    constraints of this constructor. That's worth doing just to reduce the
    work the compiler has to do during overload resolution, even if it isn't
    needed to make the code in the PR work.

    libstdc++-v3/ChangeLog:

            * include/std/span (span(Range&&)): Reorder constraints.

    (cherry picked from commit 09bc98098e4ad474d2ba9da52457b29bbd08874b)

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
                   ` (8 preceding siblings ...)
  2022-04-21 12:33 ` cvs-commit at gcc dot gnu.org
@ 2022-04-26 13:13 ` cvs-commit at gcc dot gnu.org
  2022-04-26 13:21 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-26 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

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

commit r10-10574-gba2baf20356befbba6c8d83bbb3676cfee7e146f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 1 11:32:39 2021 +0000

    libstdc++: Reorder constraints on std::span::span(Range&&) constructor.

    In PR libstdc++/103013 Tim Song pointed out that we could reorder the
    constraints of this constructor. That's worth doing just to reduce the
    work the compiler has to do during overload resolution, even if it isn't
    needed to make the code in the PR work.

    libstdc++-v3/ChangeLog:

            * include/std/span (span(Range&&)): Reorder constraints.

    (cherry picked from commit 09bc98098e4ad474d2ba9da52457b29bbd08874b)

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

* [Bug libstdc++/103013] Underconstrained constructor span(_Range&&)
  2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
                   ` (9 preceding siblings ...)
  2022-04-26 13:13 ` cvs-commit at gcc dot gnu.org
@ 2022-04-26 13:21 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2022-04-26 13:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 10.4 and 11.4 too.

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

end of thread, other threads:[~2022-04-26 13:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-31  9:48 [Bug libstdc++/103013] New: Underconstrained constructor span(_Range&&) andrey.davydov at jetbrains dot com
2021-10-31  9:50 ` [Bug libstdc++/103013] " andrey.davydov at jetbrains dot com
2021-10-31 18:11 ` redi at gcc dot gnu.org
2021-10-31 18:13 ` redi at gcc dot gnu.org
2021-11-01  3:12 ` rs2740 at gmail dot com
2021-11-01  5:23 ` andrey.davydov at jetbrains dot com
2021-11-01 11:32 ` redi at gcc dot gnu.org
2021-11-01 23:51 ` cvs-commit at gcc dot gnu.org
2021-11-01 23:54 ` redi at gcc dot gnu.org
2022-04-21 12:33 ` cvs-commit at gcc dot gnu.org
2022-04-26 13:13 ` cvs-commit at gcc dot gnu.org
2022-04-26 13:21 ` 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).