| 1 |
// PR c++/94490 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
|
| 4 |
template<class T> |
| 5 |
constexpr int fake_tuple_size_v = 3; |
| 6 |
template<int...> struct intseq {}; |
| 7 |
|
| 8 |
// So that it compiles with clang++. |
| 9 |
#if __has_builtin(__make_integer_seq) |
| 10 |
using size_t = decltype(sizeof(1)); |
| 11 |
template<typename, size_t... _Indices> |
| 12 |
using _IdxTuple = intseq<_Indices...>; |
| 13 |
|
| 14 |
template<int N> using genseq = __make_integer_seq<_IdxTuple, size_t, N>; |
| 15 |
#else |
| 16 |
template<int N> using genseq = intseq<__integer_pack(N)...>; |
| 17 |
#endif |
| 18 |
|
| 19 |
template<int A, class S = genseq<0 ? A : A>> |
| 20 |
struct arith_result |
| 21 |
{ }; |
| 22 |
|
| 23 |
template<typename T> |
| 24 |
auto Mul(const T&) |
| 25 |
{ |
| 26 |
return [](auto) { return arith_result<fake_tuple_size_v<T>> { }; }(0); |
| 27 |
} |
| 28 |
|
| 29 |
auto x = Mul(0); |