| 1 |
// PR c++/96204 |
| 2 |
|
| 3 |
template<class, class = void> |
| 4 |
struct has_type_member { |
| 5 |
static const bool value = false; |
| 6 |
}; |
| 7 |
|
| 8 |
template<class T> |
| 9 |
struct has_type_member<T, typename T::type> { |
| 10 |
static const bool value = true; |
| 11 |
}; |
| 12 |
|
| 13 |
struct Parent; |
| 14 |
|
| 15 |
struct Child { |
| 16 |
private: |
| 17 |
friend struct Parent; |
| 18 |
typedef void type; |
| 19 |
}; |
| 20 |
|
| 21 |
struct Parent { |
| 22 |
static void f() { |
| 23 |
// The partial specialization does not match despite Child::type |
| 24 |
// being accessible from the current scope. |
| 25 |
extern int x[1]; |
| 26 |
extern int x[!has_type_member<Child>::value]; |
| 27 |
} |
| 28 |
}; |