| 1 |
// PR c++/59988 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template<template<typename...> class C, typename... T> |
| 5 |
struct is_valid_specialization { |
| 6 |
typedef struct { char _; } yes; |
| 7 |
typedef struct { yes _[2]; } no; |
| 8 |
|
| 9 |
template<template<typename...> class D, typename... U> |
| 10 |
static yes test(D<U...>*); |
| 11 |
template<template<typename...> class D, typename... U> |
| 12 |
static no test(...); |
| 13 |
|
| 14 |
constexpr static bool value = (sizeof(test<C, T...>(0)) == sizeof(yes)); |
| 15 |
}; |
| 16 |
|
| 17 |
template<typename T> |
| 18 |
struct Test1 { }; |
| 19 |
|
| 20 |
template<typename T1, typename T2> |
| 21 |
struct Test2 { }; |
| 22 |
|
| 23 |
template<typename...> |
| 24 |
struct TestV { }; |
| 25 |
|
| 26 |
static_assert(!is_valid_specialization<Test1, int>::value, ""); |
| 27 |
static_assert(!is_valid_specialization<Test2, int>::value, ""); |
| 28 |
static_assert(!is_valid_specialization<TestV, int>::value, ""); |