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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-08-27
                 CC|                            |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase without any headers:
namespace std {
  using size_t = decltype (sizeof 0);
  template <typename> struct tuple_size;
  template <size_t, typename> struct tuple_element;
}

struct A {
  int a, b;
  bool c;
  constexpr explicit operator bool () const { return c; }
  template <std::size_t I>
  constexpr const int &get () const { return I == 0 ? a : b; }
};

template <>
struct std::tuple_size <A> { static constexpr int value = 2; };
template <std::size_t I>
struct std::tuple_element <I, A> { using type = const int; };

constexpr int
foo (int v)
{
  if (auto [a, b] = A { v, v * 2, v != 0 })
    return a + b;
  return -1;
}

static_assert (foo (1) == 3);
static_assert (foo (0) == -1);

Reply via email to