| 1 |
// PR c++/90880 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <typename T, typename = void> |
| 5 |
struct status |
| 6 |
{ static const bool value = false; }; |
| 7 |
|
| 8 |
template <typename T> |
| 9 |
struct status<T, decltype((void)T::member)> |
| 10 |
{ static const bool value = true; }; |
| 11 |
|
| 12 |
struct s1{int member;}; |
| 13 |
struct s2{int _member;}; |
| 14 |
|
| 15 |
class c1{int member;}; |
| 16 |
class c2{int _member;}; |
| 17 |
|
| 18 |
void |
| 19 |
foo() |
| 20 |
{ |
| 21 |
static_assert(status<s1>::value, "has member"); |
| 22 |
static_assert(!status<s2>::value, "has no member"); |
| 23 |
static_assert(!status<c1>::value, "has inaccessible member"); |
| 24 |
static_assert(!status<c2>::value, "has no member"); |
| 25 |
} |