public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/108258] New: std::ranges::begin() fails on zero sized std::array
@ 2022-12-31 19:26 mwd at md5i dot com
  2022-12-31 19:28 ` [Bug libstdc++/108258] " mwd at md5i dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mwd at md5i dot com @ 2022-12-31 19:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108258
           Summary: std::ranges::begin() fails on zero sized std::array
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mwd at md5i dot com
  Target Milestone: ---

The following snippet fails to compile (with -std=c++20) in snapshot
gcc-13-20221225.

   #include <array>
   #include <ranges>

   static constexpr std::array<int, 0> a;
   static constexpr auto b = std::ranges::begin(a);

This appears to be because __array_traits<T, 0>::Type's members aren't
constexpr.  This compiled in gcc-12.

Preprocessed sources attached.

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

* [Bug libstdc++/108258] std::ranges::begin() fails on zero sized std::array
  2022-12-31 19:26 [Bug libstdc++/108258] New: std::ranges::begin() fails on zero sized std::array mwd at md5i dot com
@ 2022-12-31 19:28 ` mwd at md5i dot com
  2022-12-31 19:58 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mwd at md5i dot com @ 2022-12-31 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Michael Duggan <mwd at md5i dot com> ---
Preprocessed source will be added once I've reduced it.  In the meantime, the
non-preprocessed source in the comment should be enough to trigger the problem
with the specified version of gcc.

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

* [Bug libstdc++/108258] std::ranges::begin() fails on zero sized std::array
  2022-12-31 19:26 [Bug libstdc++/108258] New: std::ranges::begin() fails on zero sized std::array mwd at md5i dot com
  2022-12-31 19:28 ` [Bug libstdc++/108258] " mwd at md5i dot com
@ 2022-12-31 19:58 ` pinskia at gcc dot gnu.org
  2023-01-04 11:16 ` [Bug libstdc++/108258] [13 Regression] " redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-31 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
     Ever confirmed|0                           |1
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=104719
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-12-31

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Michael Duggan from comment #1)
> Preprocessed source will be added once I've reduced it.  In the meantime,
> the non-preprocessed source in the comment should be enough to trigger the
> problem with the specified version of gcc.

No reason for the preprocessed source as the problem is in the headers of
libstdc++.

Looks like it was introduced by r13-113-gef8d5ac08b5e .

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

* [Bug libstdc++/108258] [13 Regression] std::ranges::begin() fails on zero sized std::array
  2022-12-31 19:26 [Bug libstdc++/108258] New: std::ranges::begin() fails on zero sized std::array mwd at md5i dot com
  2022-12-31 19:28 ` [Bug libstdc++/108258] " mwd at md5i dot com
  2022-12-31 19:58 ` pinskia at gcc dot gnu.org
@ 2023-01-04 11:16 ` redi at gcc dot gnu.org
  2023-01-04 11:54 ` cvs-commit at gcc dot gnu.org
  2023-01-04 11:54 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-04 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
           Keywords|                            |rejects-valid

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

* [Bug libstdc++/108258] [13 Regression] std::ranges::begin() fails on zero sized std::array
  2022-12-31 19:26 [Bug libstdc++/108258] New: std::ranges::begin() fails on zero sized std::array mwd at md5i dot com
                   ` (2 preceding siblings ...)
  2023-01-04 11:16 ` [Bug libstdc++/108258] [13 Regression] " redi at gcc dot gnu.org
@ 2023-01-04 11:54 ` cvs-commit at gcc dot gnu.org
  2023-01-04 11:54 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-04 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:1530a9b1f45a7ceb333f3e1abad65e587679690f

commit r13-4991-g1530a9b1f45a7ceb333f3e1abad65e587679690f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jan 4 11:49:19 2023 +0000

    libstdc++: Fix std::array<T, 0>::data() to be a constant expression
[PR108258]

    When I refactored the __array_traits helper I broke this.

    libstdc++-v3/ChangeLog:

            PR libstdc++/108258
            * include/std/array (__array_traits<T, 0>::operator T*()): Add
            constexpr.
            * testsuite/23_containers/array/element_access/constexpr_c++17.cc:
Check
            std::array<T, 0>::data().

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

* [Bug libstdc++/108258] [13 Regression] std::ranges::begin() fails on zero sized std::array
  2022-12-31 19:26 [Bug libstdc++/108258] New: std::ranges::begin() fails on zero sized std::array mwd at md5i dot com
                   ` (3 preceding siblings ...)
  2023-01-04 11:54 ` cvs-commit at gcc dot gnu.org
@ 2023-01-04 11:54 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-04 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed. Thanks for the report.

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

end of thread, other threads:[~2023-01-04 11:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-31 19:26 [Bug libstdc++/108258] New: std::ranges::begin() fails on zero sized std::array mwd at md5i dot com
2022-12-31 19:28 ` [Bug libstdc++/108258] " mwd at md5i dot com
2022-12-31 19:58 ` pinskia at gcc dot gnu.org
2023-01-04 11:16 ` [Bug libstdc++/108258] [13 Regression] " redi at gcc dot gnu.org
2023-01-04 11:54 ` cvs-commit at gcc dot gnu.org
2023-01-04 11:54 ` 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).