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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2025-01-08

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced to (this assumes the front-end in testing has either __integer_pack or
__make_integer_seq):
```

template<typename T, T...> struct integer_sequence { };

template<typename T, T N>
  using make_integer_sequence
#if __has_builtin(__make_integer_seq)
    = __make_integer_seq<integer_sequence, T, N>;
#else
    = integer_sequence<T, __integer_pack(N)...>;
#endif

#ifdef FAST
template<int... i>
static constexpr int v1 = ((i != 0) || ...); // fast
#else
template<int... i>
static constexpr int v1 = ((i != 0) | ...); // slow
#endif


template<int... i>
constexpr int foo(integer_sequence<int, i...>)
{
  return v1<i...>;
}

int main()
{
  static_assert(1 == foo(make_integer_sequence<int, 5000>{}));
}
```

Confirmed.  What is interesting if we use `||` instead of `|`, it is fast. This
makes sense since PR 102780 fixed the `||` case but not the |, +, extra cases.

Reply via email to