Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr80171.C

raw
1 // { dg-do compile }
2 // { dg-additional-options "-Wno-return-type" }
3
4 template <typename> struct remove_reference;
5 template <typename _Tp> struct remove_reference<_Tp &> { typedef _Tp type; };
6 template <typename _Tp> typename remove_reference<_Tp>::type move(_Tp &&p1) {
7 return static_cast<typename remove_reference<_Tp>::type &&>(p1);
8 }
9 void *operator new(__SIZE_TYPE__, void *p2) { return p2; }
10 struct Trans_NS__v1_GenericTlv {
11 virtual int getMinimumValueLength();
12 virtual unsigned long getValueLength() const;
13 };
14 struct IPv4NeighborAddressSubTlv;
15 struct Trans_NS__v1_GenericTlvBase : Trans_NS__v1_GenericTlv {
16 virtual bool operator==(const IPv4NeighborAddressSubTlv &) const;
17 };
18 struct Trans_NS__v1_GenericUnsupportedTlv;
19 template <typename> struct backup_holder {
20 Trans_NS__v1_GenericUnsupportedTlv *backup_;
21 Trans_NS__v1_GenericUnsupportedTlv &get() { return *backup_; }
22 };
23 template <typename> struct make_reference_content {
24 typedef IPv4NeighborAddressSubTlv type;
25 };
26 template <typename> struct unwrap_recursive {
27 typedef IPv4NeighborAddressSubTlv type;
28 };
29 template <typename> struct begin_impl;
30 template <typename Sequence> struct begin {
31 typedef typename Sequence::tag tag_;
32 typedef typename begin_impl<tag_>::template apply<Sequence>::type type;
33 };
34 struct long_ {
35 static const int value = 0;
36 };
37 template <typename> struct O1_size_impl;
38 template <typename Sequence>
39 struct O1_size
40 : O1_size_impl<typename Sequence::tag>::template apply<Sequence> {};
41 template <typename F, typename T2>
42 struct apply_wrap2 : F::template apply<int, T2> {};
43 template <int, typename, typename> struct iter_fold_impl;
44 template <typename First, typename ForwardOp>
45 struct iter_fold_impl<0, First, ForwardOp> {
46 typedef typename apply_wrap2<ForwardOp, First>::type state;
47 };
48 template <typename Sequence, typename ForwardOp> struct iter_fold {
49 typedef
50 typename iter_fold_impl<O1_size<Sequence>::value,
51 typename begin<Sequence>::type, ForwardOp>::state
52 type;
53 };
54 template <typename> struct deref;
55 template <typename T1> struct pair { typedef T1 first; };
56 struct make_initializer_node {
57 template <typename, typename Iterator> struct apply {
58 struct initializer_node {
59 typedef typename deref<Iterator>::type recursive_enabled_T;
60 static int
61 initialize(void *p1,
62 typename unwrap_recursive<recursive_enabled_T>::type) {
63 new (p1) typename make_reference_content<recursive_enabled_T>::type;
64 }
65 };
66 typedef pair<initializer_node> type;
67 };
68 };
69 struct l_item {
70 typedef int tag;
71 typedef l_item type;
72 typedef long_ size;
73 typedef int item;
74 };
75 template <> struct O1_size_impl<int> {
76 template <typename List> struct apply : List::size {};
77 };
78 template <typename> struct l_iter;
79 template <typename Node> struct deref<l_iter<Node>> {
80 typedef typename Node::item type;
81 };
82 template <> struct begin_impl<int> {
83 template <typename List> struct apply {
84 typedef l_iter<typename List::type> type;
85 };
86 };
87 template <typename, typename, typename, typename, typename, typename, typename>
88 struct list : l_item {};
89 template <typename... T> struct make_variant_list { typedef list<T...> type; };
90 template <typename T> T cast_storage(void *p1) { return *static_cast<T *>(p1); }
91 struct visitation_impl_step {
92 typedef Trans_NS__v1_GenericUnsupportedTlv type;
93 };
94 template <typename Visitor, typename VoidPtrCV, typename T>
95 void visitation_impl_invoke_impl(Visitor p1, VoidPtrCV p2, T *) {
96 backup_holder<Trans_NS__v1_GenericUnsupportedTlv> __trans_tmp_8 =
97 cast_storage<backup_holder<T>>(p2);
98 p1.internal_visit(__trans_tmp_8, 0);
99 }
100 template <typename Visitor, typename VoidPtrCV, typename T,
101 typename NoBackupFlag>
102 void visitation_impl_invoke(Visitor p1, VoidPtrCV p2, T p3, NoBackupFlag) {
103 visitation_impl_invoke_impl(p1, p2, p3);
104 }
105 template <typename Which, typename step0, typename Visitor, typename VoidPtrCV,
106 typename NoBackupFlag>
107 void visitation_impl(Visitor p1, VoidPtrCV p2, NoBackupFlag, Which, step0 *) {
108 visitation_impl_invoke(p1, p2, static_cast<typename step0::type *>(0), 0);
109 }
110 struct move_into {
111 move_into(void *);
112 template <typename T> void internal_visit(backup_holder<T> p1, int) {
113 T __trans_tmp_2 = p1.get();
114 new (0) T(__trans_tmp_2);
115 }
116 };
117 template <typename, typename... TN> struct variant {
118 struct initializer : iter_fold<typename make_variant_list<int, TN...>::type,
119 make_initializer_node>::type::first {};
120 template <typename T> void convert_construct(T p1, int) {
121 void *__trans_tmp_9 = this;
122 initializer::initialize(__trans_tmp_9, p1);
123 }
124 template <typename T> variant(T p1) { convert_construct(p1, 0); }
125 variant(variant &&p1) {
126 move_into visitor(0);
127 p1.internal_apply_visitor(visitor);
128 }
129 template <typename Visitor> void internal_apply_visitor(Visitor p1) {
130 void *__trans_tmp_10 = this;
131 visitation_impl(p1, __trans_tmp_10, 0, 0,
132 static_cast<visitation_impl_step *>(0));
133 }
134 };
135 template <class...> struct generic_element_tlvs;
136 template <typename TlvConfig, class UnsupportedTlvClass, class TlvF,
137 class... TlvR>
138 struct generic_element_tlvs<TlvConfig, UnsupportedTlvClass, TlvF, TlvR...> {
139 typedef variant<UnsupportedTlvClass, TlvF, TlvR...> variant_type;
140 };
141 template <typename, typename> struct Trans_NS__v1_GenericTlvContainer {
142 template <class TlvClass> void addTlv(const TlvClass &);
143 };
144 template <typename TlvConfig, typename ElementTlvs>
145 template <class TlvClass>
146 void Trans_NS__v1_GenericTlvContainer<TlvConfig, ElementTlvs>::addTlv(
147 const TlvClass &p1) {
148 typename ElementTlvs::variant_type wrap(p1);
149 move(wrap);
150 }
151 template <typename ElementTlvs>
152 struct Trans_NS__v1_GenericContainerEntryBase
153 : Trans_NS__v1_GenericTlvContainer<int, ElementTlvs> {};
154 template <class>
155 struct Trans_NS__v1_GenericFixedLengthTlvBase : Trans_NS__v1_GenericTlvBase {
156 unsigned long getValueLength() const;
157 };
158 struct Trans_NS__v1_GenericUnsupportedTlv : Trans_NS__v1_GenericTlv {
159 long getHeaderLengthconst;
160 };
161 using isis_tlv_config = int;
162 template <class... TlvClasses>
163 using isis_element_tlvs =
164 generic_element_tlvs<isis_tlv_config, Trans_NS__v1_GenericUnsupportedTlv,
165 TlvClasses...>;
166 template <int, class, typename ElementTlvs>
167 using ContainerEntryBase = Trans_NS__v1_GenericContainerEntryBase<ElementTlvs>;
168 template <int, class ImplClass, int>
169 using FixedLengthTlvBase = Trans_NS__v1_GenericFixedLengthTlvBase<ImplClass>;
170 struct IPv4NeighborAddressSubTlv
171 : FixedLengthTlvBase<0, IPv4NeighborAddressSubTlv, 0> {
172 bool operator==(const IPv4NeighborAddressSubTlv &) const;
173 };
174 void test() {
175 ContainerEntryBase<
176 0, int,
177 isis_element_tlvs<
178 FixedLengthTlvBase<0, int, 0>, FixedLengthTlvBase<0, int, 0>,
179 IPv4NeighborAddressSubTlv, FixedLengthTlvBase<0, int, 0>,
180 FixedLengthTlvBase<0, int, 0>, FixedLengthTlvBase<0, int, 0>>>
181 isEntry;
182 IPv4NeighborAddressSubTlv nbAddressSubTlv;
183 isEntry.addTlv(nbAddressSubTlv);
184 }