OSDN Git Service

PR c++/50972
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / cpp0x / noexcept16.C
1 // PR c++/50972
2 // { dg-do compile { target c++11 } }
3 // Ignore all errors, we're just testing that this doesn't ICE
4 // { dg-prune-output "error" }
5
6 namespace std
7 typedef long unsigned int size_t;
8 template<typename...>
9 struct __and_;
10 template<typename _Tp>
11 struct is_nothrow_move_constructible
12 {
13 };
14 template<typename _Tp>
15 struct is_nothrow_move_assignable
16 struct __add_rvalue_reference_helper<_Tp, true>
17 { typedef _Tp&& type; };
18 template<typename _Tp>
19 struct add_rvalue_reference
20   : public __add_rvalue_reference_helper<_Tp>
21 {
22 };
23 template<typename _Tp>
24 inline typename add_rvalue_reference<_Tp>::type
25 declval() noexcept
26 {
27 }
28 }
29 namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
30 template<typename _Tp>
31 class new_allocator
32 {
33 };
34 }
35 namespace std __attribute__ ((__visibility__ ("default")))
36 class allocator: public __gnu_cxx::new_allocator<_Tp>
37 {
38   template<typename _Tp1>
39   struct rebind
40   { typedef allocator<_Tp1> other; };
41 };
42 }
43 namespace std __attribute__ ((__visibility__ ("default")))
44 template<typename _Alloc, typename _Tp>
45 struct __alloctr_rebind<_Alloc, _Tp, true>
46 {
47   typedef typename _Alloc::template rebind<_Tp>::other __type;
48 };
49 template<typename _Alloc>
50 struct allocator_traits
51 {
52   template<typename _Tp>
53   struct __rebind_alloc
54   {
55     typedef typename __alloctr_rebind<_Alloc, _Tp>::__type __type;
56   };
57 }
58   }
59 namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
60 template<typename _Alloc>
61 struct __alloc_traits
62 {
63   typedef std::allocator_traits<_Alloc> _Base_type;
64   static constexpr bool _S_nothrow_swap()
65   {
66     return !_S_propagate_on_swap()
67       || noexcept(swap(std::declval<_Alloc&>(), std::declval<_Alloc&>()));
68   }
69   template<typename _Tp>
70   struct rebind
71   { typedef typename _Base_type::template __rebind_alloc<_Tp>::__type other; };
72 };
73 }
74 namespace std __attribute__ ((__visibility__ ("default")))
75 template<typename _Tp, typename _Alloc>
76 struct _Vector_base
77 {
78   typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template
79   rebind<_Tp>::other _Tp_alloc_type;
80 };
81 template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
82 class vector : protected _Vector_base<_Tp, _Alloc>
83 {
84   typedef _Vector_base<_Tp, _Alloc> _Base;
85   typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
86   typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits;
87   swap(vector& __x)
88   noexcept(_Alloc_traits::_S_nothrow_swap());
89 };
90 }
91 namespace lexertl
92 namespace detail
93 }
94 namespace detail
95 template<typename id_type>
96 struct basic_internals
97 {
98   typedef std::vector<id_type> id_type_vector;
99 };
100 };
101 template<typename char_type, typename id_type = std::size_t>
102 class basic_state_machine
103 {
104   typedef detail::basic_internals<id_type> internals;
105   void minimise ()
106   {
107     minimise_dfa (dfa_alphabet_, *dfa_, size_);
108   }
109   typedef typename internals::id_type_vector id_type_vector;
110   void minimise_dfa (const id_type dfa_alphabet_,
111                      id_type_vector &dfa_, std::size_t size_)
112   {
113     id_type_vector new_dfa_ (front_, front_ + dfa_alphabet_);
114     dfa_.swap (new_dfa_);
115   }
116 }
117   }
118 namespace std __attribute__ ((__visibility__ ("default")))
119 template<typename _Tp>
120 void
121 swap(_Tp&, _Tp&)
122   noexcept(__and_<is_nothrow_move_constructible<_Tp>,
123            is_nothrow_move_assignable<_Tp>>::value)
124   ;
125 typedef lexertl::basic_state_machine<char32_t> lexstate;
126 lexstate m_state_machine;
127 GenerateLexer()
128 {
129   m_state_machine.minimise();
130 }