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

            Bug ID: 118305
           Summary: Wrong deduced type for array bound
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cmingyi01 at gmail dot com
  Target Milestone: ---

The following code should be valid, but because GCC deduces `N` to be the wrong
type, it is rejected.
```c++
template<auto N>
constexpr auto size(int (*)[N]) {
    return N;
}
using size_t = decltype(sizeof 0);
using size_t = decltype(::size(static_cast<int (*)[1]>(0)));
```

See https://compiler-explorer.com/z/a6qxaKa9s.

Reply via email to