| 1 |
// PR c++/96204 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
// A variant of access40.C where has_type_member is a variable template instead |
| 4 |
// of a class template. |
| 5 |
|
| 6 |
template<class, class = void> |
| 7 |
constexpr bool has_type_member = false; |
| 8 |
|
| 9 |
template<class T> |
| 10 |
constexpr bool has_type_member<T, typename T::type> = true; |
| 11 |
|
| 12 |
struct Parent; |
| 13 |
|
| 14 |
struct Child { |
| 15 |
private: |
| 16 |
friend struct Parent; |
| 17 |
typedef void type; |
| 18 |
}; |
| 19 |
|
| 20 |
struct Parent { |
| 21 |
// The partial specialization does not match despite Child::type |
| 22 |
// being accessible from the current scope. |
| 23 |
static_assert(!has_type_member<Child>, ""); |
| 24 |
}; |