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

            Bug ID: 111455
           Summary: [14 Regression] Using incorrect cast operator on
                    integer_pack
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

As I wrote in
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630095.html
I'm not sure casting the argument to integer_type_node is the right thing.

Consider:
#include <utility>

template<long... V>
void foo (std::integer_sequence<long, V...>)
{}

template<typename ...T>
struct U
{
  static constexpr long value = 1;
  constexpr operator int() = delete;
  constexpr operator long() { return value; }
};
template<typename T>
struct R
{
  using S = std::make_integer_sequence<long, U<T> {}>;
  R () noexcept(noexcept(foo (S ()))) {}
};

int
main()
{
  R<long>();
}

is accepted when using clang++, but rejected on the trunk with
<source>: In instantiation of 'R<T>::R() [with T = long int]':
<source>:24:11:   required from here
<source>:18:31: error: use of deleted function 'constexpr U<T>::operator int()
[with T = {long int}]'
   18 |   R () noexcept(noexcept(foo (S ()))) {}
      |                               ^~~~
<source>:11:13: note: declared here
   11 |   constexpr operator int() = delete;
      |             ^~~~~~~~
(previously it has been rejected due to PR111357, but e.g. g++ 6.4 accepted
it).
Two template arguments std::make_integer_sequence is declared as
template<class T, T N>
    using make_integer_sequence = integer_sequence<T, see below>;
so I believe it should cast U<long> {} to long first before casting it further
to whatever it needs under the hood.

Reply via email to