| 1 |
// PR c++/107049 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// Failed access check should be a substitution failure, not an error. |
| 4 |
|
| 5 |
template<bool B> |
| 6 |
struct bool_constant { static constexpr bool value = B; }; |
| 7 |
|
| 8 |
template<typename From, typename To> |
| 9 |
struct is_convertible |
| 10 |
: public bool_constant<__is_convertible(From, To)> |
| 11 |
{ }; |
| 12 |
|
| 13 |
#if __cpp_variable_templates |
| 14 |
template<typename From, typename To> |
| 15 |
constexpr bool is_convertible_v = __is_convertible(From, To); |
| 16 |
#endif |
| 17 |
|
| 18 |
class Private |
| 19 |
{ |
| 20 |
operator int() const |
| 21 |
{ |
| 22 |
static_assert( not is_convertible<Private, int>::value, "" ); |
| 23 |
#if __cpp_variable_templates |
| 24 |
static_assert( not is_convertible_v<Private, int>, "" ); |
| 25 |
#endif |
| 26 |
return 0; |
| 27 |
} |
| 28 |
}; |
| 29 |
|
| 30 |
static_assert( not is_convertible<Private, int>::value, "" ); |
| 31 |
#if __cpp_variable_templates |
| 32 |
static_assert( not is_convertible_v<Private, int>, "" ); |
| 33 |
#endif |