2 // { dg-do compile { target c++11 } }
4 template<bool B> struct bool_type
5 { static constexpr bool value = B; };
7 using true_type = bool_type<true>;
8 using false_type = bool_type<false>;
10 template<typename T> T&& declval();
12 template<typename...> struct void_ { using type = void; };
13 template<typename... I> using void_t = typename void_<I...>::type;
15 template<typename _Tp, typename = void>
16 struct _Has_addressof_free: false_type { };
18 template<typename _Tp>
19 struct _Has_addressof_free
20 <_Tp, void_t<decltype( operator&(declval<const _Tp&>()) )>>
24 void operator&(foo) = delete;
28 static_assert( !_Has_addressof_free<int>::value, "" );
29 // error: use of deleted function 'void operator&(foo)'
30 static_assert( !_Has_addressof_free<foo>::value, "" );