public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113638] New: Array bounds of variable templates are not correctly deduced from initializers since GCC13
@ 2024-01-28 15:21 de34 at live dot cn
  2024-01-28 15:28 ` [Bug c++/113638] " de34 at live dot cn
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: de34 at live dot cn @ 2024-01-28 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113638
           Summary: Array bounds of variable templates are not correctly
                    deduced from initializers since GCC13
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Keywords: accepts-invalid, rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: de34 at live dot cn
  Target Milestone: ---

The following code snippet is incorrectly processed since C++13.

Godbolt link: https://godbolt.org/z/xjEqnqodj

```
#include <type_traits>

template<int ...Is>
constexpr int my_array[]{Is...};

static_assert(std::is_same_v<decltype(my_array<1, 2, 3, 4, 5>), const int[5]>);
// rejected since GCC13
static_assert(sizeof(my_array<1, 2, 3, 4, 5>) == sizeof(int) * 5); // rejected
since GCC13

static_assert(std::is_same_v<decltype(my_array<1, 2, 3, 4, 5>), const int[]>);
// passes since GCC13, but should not
```

It seems that GCC gives up deducing the array bounds from initializers of
variable templates since GCC13.

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

end of thread, other threads:[~2024-02-02 16:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-28 15:21 [Bug c++/113638] New: Array bounds of variable templates are not correctly deduced from initializers since GCC13 de34 at live dot cn
2024-01-28 15:28 ` [Bug c++/113638] " de34 at live dot cn
2024-01-28 18:56 ` [Bug c++/113638] [13/14 Regression] " pinskia at gcc dot gnu.org
2024-01-28 21:51 ` [Bug c++/113638] [13/14 Regression] Array bounds of variable templates are not correctly deduced from initializers since GCC13 inside a decltype/sizeof pinskia at gcc dot gnu.org
2024-01-29 15:58 ` ppalka at gcc dot gnu.org
2024-01-29 21:33 ` ppalka at gcc dot gnu.org
2024-01-29 21:44 ` pinskia at gcc dot gnu.org
2024-01-29 22:09 ` ppalka at gcc dot gnu.org
2024-02-01 21:41 ` jason at gcc dot gnu.org
2024-02-02  3:22 ` cvs-commit at gcc dot gnu.org
2024-02-02 15:57 ` cvs-commit at gcc dot gnu.org
2024-02-02 16:12 ` jason 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).