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

--- Comment #2 from Namniav <namniav at gmail dot com> ---
Now Clang also crashes on the original
example(https://github.com/llvm/llvm-project/issues/64607), although its cause
may be different to GCC's.

I can't remember why I used `get` instead of `std::get` in original code
because I didn't really know how ADL finds function templates. The issue still
exists with `std::get`.

Here is a modified and GCC-only reduced version:
https://godbolt.org/z/MMYMrGE3z

```c++
template<typename T, int I>
concept C = (sizeof(I) + sizeof(T) > 0);

template<typename T, int...I>
constexpr bool check() {
    return ((requires(T t) {
                { (I, t) } -> C<I>;
            }) && ...);
}

template<class T>
concept tuple_like = check<T, 0>();

static_assert(tuple_like<int>);
```

Noted that GCC doesn't consider using `I` in `-> C<I>` as using a parameter
pack, I have to use it in comma expression `(I, t)` to get a fold expression,
otherwise GCC complains "operand of fold expression has no unexpanded parameter
packs". I suspect that GCC has problem with such case. It some how explains,
for GCC only, why replacing `std::tuple_element_t<I, T>&` with `int&` "fixes"
the issue.

Reply via email to