| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
template<class> struct X { static const bool primary = true; }; |
| 3 |
template<class R, class... ArgTypes> struct X<R(int, ArgTypes...)> { |
| 4 |
static const bool primary = false; |
| 5 |
}; |
| 6 |
template<class... Types> struct Y { static const bool primary = true; }; |
| 7 |
template<class T, class... Types> struct Y<T, Types&...> { |
| 8 |
static const bool primary = false; |
| 9 |
}; |
| 10 |
|
| 11 |
static_assert (X<int>::primary, "uses primary template"); |
| 12 |
static_assert (!X<int(int, float, double)>::primary, |
| 13 |
"uses partial specialization"); |
| 14 |
static_assert (X<int(float, int)>::primary, "uses primary template"); |
| 15 |
static_assert (Y<>::primary, "uses primary template"); |
| 16 |
static_assert (!Y<int&, float&, double&>::primary, |
| 17 |
"uses partial specialization"); |
| 18 |
static_assert (Y<int, float, double>::primary, "uses primary template"); |