| 1 |
// PR c++/67021 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template<typename> struct Dummy; |
| 5 |
template<> struct Dummy<int> {}; |
| 6 |
|
| 7 |
template <class...> |
| 8 |
struct all_same { static constexpr bool value = true; }; |
| 9 |
template <class T, class...Rest> |
| 10 |
struct all_same<T, T, Rest...> : all_same<T, Rest...> {}; |
| 11 |
template <class T, class U, class...Rest> |
| 12 |
struct all_same<T, U, Rest...> { static constexpr bool value = false; }; |
| 13 |
|
| 14 |
template <class R> |
| 15 |
using ValueType = int; |
| 16 |
|
| 17 |
template <class I> |
| 18 |
constexpr bool A(I i) { |
| 19 |
return all_same<ValueType<I>, ValueType<decltype(i++)>>::value; |
| 20 |
} |
| 21 |
|
| 22 |
int main() { |
| 23 |
static_assert(A(42), ""); |
| 24 |
} |