re PR middle-end/71387 (ICE in emit_move_insn, at expr.c:3418 with -Og)
[platform/upstream/gcc.git] / gcc / testsuite / g++.dg / cpp0x / deleted9.C
1 // PR c++/64352
2 // { dg-do compile { target c++11 } }
3
4 template<bool B> struct bool_type
5 { static constexpr bool value = B; };
6
7 using true_type = bool_type<true>;
8 using false_type = bool_type<false>;
9
10 template<typename T> T&& declval();
11
12 template<typename...> struct void_ { using type = void; };
13 template<typename... I> using void_t = typename void_<I...>::type;
14
15 template<typename _Tp, typename = void>
16 struct _Has_addressof_free: false_type { };
17
18 template<typename _Tp>
19 struct _Has_addressof_free
20 <_Tp, void_t<decltype( operator&(declval<const _Tp&>()) )>>
21 : true_type { };
22
23 struct foo {};
24 void operator&(foo) = delete;
25
26 int main()
27 {
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, "" );
31 }