]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/result_of/sfinae_friendly_1.cc
Use effective-target instead of -std options
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / result_of / sfinae_friendly_1.cc
1 // { dg-do compile { target c++11 } }
2
3 // Copyright (C) 2012-2016 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
19
20 #include <memory>
21 #include <cstddef>
22 #include <type_traits>
23
24 // TODO: Uncomment the following define once gcc has fixed bug 52748
25 // (incomplete types in function call expressions):
26 //#define HAS_52748_FIXED
27
28 // Helper types:
29 struct has_type_impl
30 {
31 template<typename T, typename = typename T::type>
32 static std::true_type test(int);
33
34 template<typename>
35 static std::false_type test(...);
36 };
37
38 template<typename T>
39 struct has_type : public decltype(has_type_impl::test<T>(0))
40 {};
41
42 template<typename T, typename Res>
43 struct is_expected_type : public std::is_same<typename T::type, Res>
44 {};
45
46 template<typename P1, typename P2>
47 struct and_ : public std::conditional<P1::value, P2, std::false_type>::type
48 {};
49
50 template<typename T, typename Res>
51 struct is_type : public and_<has_type<T>, is_expected_type<T, Res>>
52 {};
53
54 // Types under inspection:
55
56 typedef bool (&PF1)();
57 typedef short (*PF2)(long);
58
59 struct S {
60 operator PF2() const;
61 double operator()(char, int&);
62 void calc(long) const;
63 };
64
65 typedef void (S::*PMS)(long) const;
66 typedef void (S::*PMSnonconst)(long);
67
68 typedef int S::* PMI;
69
70 struct B {
71 int i;
72 void f1() const;
73 bool f2(int) const volatile;
74 };
75
76 struct D : B {};
77
78 typedef void (B::*base_func_void)() const;
79 typedef bool (B::*base_func_bool_int)(int) const volatile;
80
81 struct ident_functor {
82 template<typename T>
83 T operator()(T&& x);
84 };
85
86 template<typename Ret = void>
87 struct variable_functor {
88 template<typename... T>
89 Ret operator()(T&&...);
90 };
91
92 struct ident_functor_noref {
93 template<typename T>
94 typename std::remove_reference<T>::type operator()(T&& x);
95 };
96
97 enum class ScEn;
98
99 enum UnScEn : int;
100
101 union U {
102 int i;
103 double d;
104 };
105
106 union U2 {
107 int i;
108 bool b;
109 void operator()() const;
110 int operator()(double) const;
111 bool operator()(double);
112 U operator()(int, int);
113 };
114
115 struct Ukn;
116
117 typedef Ukn (S::*PMSIncomplete)(long) const;
118 typedef Ukn (S::*PMSIncompletenonconst)(long);
119 typedef Ukn (*FuncIncomplete)(long);
120
121 struct Abstract {
122 virtual ~Abstract() = 0;
123 };
124
125 struct Private {
126 private:
127 void operator()();
128 int operator()(int);
129 public:
130 bool operator()(std::nullptr_t);
131 };
132
133 union PrivateUnion {
134 double d;
135 private:
136 void operator()();
137 int operator()(int);
138 public:
139 bool operator()(std::nullptr_t);
140 };
141
142 template<typename T>
143 struct ImplicitTo {
144 operator T();
145 };
146
147 template<typename>
148 struct never { static const bool value = false; };
149
150 template<typename T>
151 struct BrokenTrait {
152 static_assert(never<T>::value, "Error!");
153 typedef T type;
154 };
155
156 template<typename T>
157 struct BadSmartPtr : T {
158 T& operator*() const noexcept(typename BrokenTrait<T>::type());
159 };
160
161 template<typename Ret>
162 using FuncEllipses = Ret(...);
163
164 static_assert(is_type<std::result_of<S(int)>, short>::value, "Error!");
165 static_assert(is_type<std::result_of<S&(unsigned char, int&)>,
166 double>::value, "Error!");
167 static_assert(is_type<std::result_of<PF1()>, bool>::value, "Error!");
168 static_assert(is_type<std::result_of<PF1&()>, bool>::value, "Error!");
169 static_assert(is_type<std::result_of<PMS(std::unique_ptr<S>, int)>,
170 void>::value, "Error!");
171 static_assert(is_type<std::result_of<PMS(std::unique_ptr<S>&, unsigned&)>,
172 void>::value, "Error!");
173 static_assert(is_type<std::result_of<PMS&(std::unique_ptr<S>, int)>,
174 void>::value, "Error!");
175 static_assert(is_type<std::result_of<PMS&(std::unique_ptr<S>&, unsigned&)>,
176 void>::value, "Error!");
177
178 static_assert(is_type<std::result_of<ident_functor(int)>,
179 int>::value, "Error!");
180 static_assert(is_type<std::result_of<ident_functor(const int)>,
181 int>::value, "Error!");
182 static_assert(is_type<std::result_of<ident_functor(const int&&)>,
183 int>::value, "Error!");
184 static_assert(is_type<std::result_of<ident_functor(int&&)>,
185 int>::value, "Error!");
186 static_assert(is_type<std::result_of<ident_functor(int&)>,
187 int&>::value, "Error!");
188
189 static_assert(is_type<std::result_of<ident_functor(const B)>,
190 B>::value, "Error!");
191 static_assert(is_type<std::result_of<ident_functor(const B&&)>,
192 const B>::value, "Error!");
193 static_assert(is_type<std::result_of<ident_functor(B&&)>, B>::value, "Error!");
194 static_assert(is_type<std::result_of<ident_functor(B&)>, B&>::value, "Error!");
195
196 static_assert(is_type<std::result_of<int B::*(B&)>, int&>::value, "Error!");
197
198 // This is expected as of CWG 616 P/R:
199 static_assert(is_type<std::result_of<int B::*(B)>, int&&>::value, "Error!");
200
201 static_assert(is_type<std::result_of<volatile int B::*(const B&&)>,
202 const volatile int&&>::value, "Error!");
203 static_assert(is_type<std::result_of<const int B::*(volatile B&&)>,
204 const volatile int&&>::value, "Error!");
205
206 static_assert(is_type<std::result_of<int B::*(const B&)>,
207 const int&>::value, "Error!");
208 static_assert(is_type<std::result_of<volatile int B::*(const B&)>,
209 const volatile int&>::value, "Error!");
210 static_assert(is_type<std::result_of<const int B::*(volatile B&)>,
211 const volatile int&>::value, "Error!");
212
213 static_assert(is_type<std::result_of<int B::*(B*)>, int&>::value, "Error!");
214 static_assert(is_type<std::result_of<int B::*(B*&)>, int&>(), "Error!");
215 static_assert(is_type<std::result_of<int B::*(const B*)>,
216 const int&>::value, "Error!");
217 static_assert(is_type<std::result_of<int B::*(const B*&)>,
218 const int&>::value, "Error!");
219 static_assert(is_type<std::result_of<volatile int B::*(const B*)>,
220 const volatile int&>::value, "Error!");
221 static_assert(is_type<std::result_of<const int B::*(volatile B*)>,
222 const volatile int&>::value, "Error!");
223
224 static_assert(is_type<std::result_of<base_func_void(const B&)>,
225 void>::value, "Error!");
226 static_assert(is_type<std::result_of<base_func_void(const B*)>,
227 void>::value, "Error!");
228 static_assert(is_type<std::result_of<base_func_void(B&)>,
229 void>::value, "Error!");
230 static_assert(is_type<std::result_of<base_func_void(B*)>,
231 void>::value, "Error!");
232
233 static_assert(!has_type<std::result_of<base_func_void(volatile B&)>>::value,
234 "Error!");
235 static_assert(!has_type<std::result_of<base_func_void(volatile B*)>>::value,
236 "Error!");
237
238 static_assert(is_type<std::result_of<base_func_bool_int(B&, long)>,
239 bool>::value, "Error!");
240 static_assert(is_type<std::result_of<base_func_bool_int(B*, long)>,
241 bool>::value, "Error!");
242 static_assert(is_type<std::result_of<base_func_bool_int(volatile B&, long)>,
243 bool>::value, "Error!");
244 static_assert(is_type<std::result_of<base_func_bool_int(volatile B*, long)>,
245 bool>::value, "Error!");
246
247 static_assert(!has_type<std::result_of<int()>>(), "Error!");
248 static_assert(!has_type<std::result_of<void()>>(), "Error!");
249 static_assert(!has_type<std::result_of<int(int)>>(), "Error!");
250 static_assert(!has_type<std::result_of<void(int)>>(), "Error!");
251 static_assert(!has_type<std::result_of<PF1(int)>>(), "Error!");
252 static_assert(is_type<std::result_of<PF2(long)>, short>(), "Error!");
253 static_assert(!has_type<std::result_of<PF2()>>(), "Error!");
254 static_assert(!has_type<std::result_of<PF2(B)>>(), "Error!");
255 static_assert(!has_type<std::result_of<PF2(ScEn)>>(), "Error!");
256 static_assert(is_type<std::result_of<PF2(UnScEn)>, short>(), "Error!");
257 static_assert(!has_type<std::result_of<PF2(long, int)>>(), "Error!");
258 static_assert(is_type<std::result_of<PMS(std::unique_ptr<S>, int)>, void>(),
259 "Error!");
260 static_assert(!has_type<std::result_of<PMS(int)>>(), "Error!");
261 static_assert(!has_type<std::result_of<PMS(int, std::unique_ptr<S>)>>(), "Error!");
262
263 // Argument number mismatch:
264 static_assert(!has_type<std::result_of<PMS(std::unique_ptr<S>)>>(), "Error!");
265 static_assert(!has_type<std::result_of<PMS(std::unique_ptr<S>&)>>(), "Error!");
266 static_assert(!has_type<std::result_of<PMS(std::unique_ptr<S>, int, bool)>>(),
267 "Error!");
268 static_assert(!has_type<std::result_of<PMS(std::unique_ptr<S>&, int, bool)>>(),
269 "Error!");
270 static_assert(!has_type<std::result_of<PMS(S)>>(), "Error!");
271 static_assert(!has_type<std::result_of<PMS(S&)>>(), "Error!");
272 static_assert(!has_type<std::result_of<PMS(S, int, bool)>>(), "Error!");
273 static_assert(!has_type<std::result_of<PMS(S&, int, bool)>>(), "Error!");
274
275 // Non-convertible arguments:
276 static_assert(!has_type<std::result_of<PMS(std::unique_ptr<S>, S)>>(),
277 "Error!");
278 static_assert(!has_type<std::result_of<PMS(std::unique_ptr<S>&, S)>>(),
279 "Error!");
280 static_assert(!has_type<std::result_of<PMS(S, S)>>(), "Error!");
281 static_assert(!has_type<std::result_of<PMS(S&, S)>>(), "Error!");
282
283 // cv-violations:
284 static_assert(!has_type<std::result_of<PMSnonconst(const S&, long)>>(),
285 "Error!");
286 static_assert(!has_type<std::result_of<PMSnonconst(const S&&, long)>>(),
287 "Error!");
288 static_assert(!has_type<std::result_of<PMSnonconst(const S*, long)>>(),
289 "Error!");
290 static_assert(!has_type<std::result_of<PMSnonconst(const S*&, long)>>(),
291 "Error!");
292
293 static_assert(is_type<std::result_of<PMI(S*)>, int&>(), "Error!");
294 static_assert(is_type<std::result_of<PMI(S&)>, int&>(), "Error!");
295 static_assert(is_type<std::result_of<PMI(S&&)>, int&&>(), "Error!");
296 static_assert(is_type<std::result_of<PMI(S)>, int&&>(), "Error!");
297
298 static_assert(!has_type<std::result_of<PMI()>>(), "Error!");
299
300 static_assert(!has_type<std::result_of<PMI(S*, int)>>(), "Error!");
301 static_assert(!has_type<std::result_of<PMI(S&, int)>>(), "Error!");
302 static_assert(!has_type<std::result_of<PMI(S*, int, S, bool)>>(), "Error!");
303 static_assert(!has_type<std::result_of<PMI(S&, int, S, bool)>>(), "Error!");
304
305 static_assert(!has_type<std::result_of<PMI(B*)>>(), "Error!");
306 static_assert(!has_type<std::result_of<PMI(B&)>>(), "Error!");
307
308 static_assert(is_type<std::result_of<int U::*(U)>, int&&>(), "Error!");
309 static_assert(is_type<std::result_of<int U::*(U&)>, int&>(), "Error!");
310 static_assert(is_type<std::result_of<int U::*(const U&)>, const int&>(),
311 "Error!");
312 static_assert(is_type<std::result_of
313 <volatile int U::*(const U&)>, const volatile int&>(), "Error!");
314 static_assert(is_type<std::result_of
315 <const int U::*(volatile U&)>, const volatile int&>(), "Error!");
316
317 static_assert(is_type<std::result_of<int Ukn::*(Ukn*)>, int&>(), "Error!");
318 static_assert(is_type<std::result_of<int Ukn::*(Ukn&)>, int&>(), "Error!");
319 static_assert(is_type<std::result_of<int Ukn::*(Ukn&&)>, int&&>(), "Error!");
320 static_assert(is_type<std::result_of<int Ukn::*(const Ukn*)>, const int&>(),
321 "Error!");
322 static_assert(is_type<std::result_of<int Ukn::*(const Ukn&)>, const int&>(),
323 "Error!");
324 static_assert(is_type<std::result_of<int Ukn::*(const Ukn&&)>, const int&&>(),
325 "Error!");
326
327 typedef void (Ukn::* PUfnMF)();
328 typedef void (Ukn::* PUfnConstMF)() const;
329
330 static_assert(is_type<std::result_of<PUfnMF(Ukn*)>, void>(), "Error!");
331 static_assert(is_type<std::result_of<PUfnMF(Ukn&)>, void>(), "Error!");
332 static_assert(is_type<std::result_of<PUfnMF(Ukn&&)>, void>(), "Error!");
333 static_assert(is_type<std::result_of<PUfnConstMF(Ukn*)>, void>(), "Error!");
334 static_assert(is_type<std::result_of<PUfnConstMF(Ukn&)>, void>(), "Error!");
335 static_assert(is_type<std::result_of<PUfnConstMF(Ukn&&)>, void>(), "Error!");
336 static_assert(is_type<std::result_of<PUfnConstMF(const Ukn*)>, void>(),
337 "Error!");
338 static_assert(is_type<std::result_of<PUfnConstMF(const Ukn&)>, void>(),
339 "Error!");
340 static_assert(is_type<std::result_of<PUfnConstMF(const Ukn&&)>, void>(),
341 "Error!");
342
343 static_assert(!has_type<std::result_of<S()>>(), "Error!");
344 static_assert(!has_type<std::result_of<S(int, S)>>(), "Error!");
345 static_assert(!has_type<std::result_of<S(S)>>(), "Error!");
346 static_assert(!has_type<std::result_of
347 <S(double, bool, std::nullptr_t, Ukn&)>>(), "Error!");
348
349 static_assert(is_type<std::result_of<U2()>, void>(), "Error!");
350 static_assert(is_type<std::result_of<const U2&()>, void>(), "Error!");
351 static_assert(is_type<std::result_of<U2&()>, void>(), "Error!");
352 static_assert(is_type<std::result_of<U2(double)>, bool>(), "Error!");
353 static_assert(is_type<std::result_of<const U2&(double)>, int>(), "Error!");
354 static_assert(is_type<std::result_of<U2&(double)>, bool>(), "Error!");
355 static_assert(is_type<std::result_of<U2(int)>, bool>(), "Error!");
356 static_assert(is_type<std::result_of<U2&(int)>, bool>(), "Error!");
357 static_assert(is_type<std::result_of<const U2&(int)>, int>(), "Error!");
358 static_assert(is_type<std::result_of<U2(int, int)>, U>(), "Error!");
359 static_assert(is_type<std::result_of<U2&(int, int)>, U>(), "Error!");
360
361 static_assert(!has_type<std::result_of<const U2&(int, int)>>(), "Error!");
362 static_assert(!has_type<std::result_of<U2(int, int, int)>>(), "Error!");
363 static_assert(!has_type<std::result_of<U2&(int, int, int)>>(), "Error!");
364 static_assert(!has_type<std::result_of<const U2&(int, int, int)>>(), "Error!");
365
366 static_assert(is_type<std::result_of<ident_functor(int)>, int>(), "Error!");
367 static_assert(is_type<std::result_of<ident_functor(const volatile int)>,
368 int>(), "Error!");
369 static_assert(is_type<std::result_of<ident_functor(int&)>, int&>(), "Error!");
370 static_assert(is_type<std::result_of<ident_functor(const volatile int&)>,
371 const volatile int&>(), "Error!");
372 static_assert(is_type<std::result_of<ident_functor(int&&)>, int>(), "Error!");
373 static_assert(is_type<std::result_of<ident_functor(const volatile int&&)>,
374 int>(), "Error!");
375 static_assert(is_type<std::result_of<ident_functor(Abstract&)>, Abstract&>(),
376 "Error!");
377 static_assert(is_type<std::result_of<ident_functor(const volatile Abstract&)>,
378 const volatile Abstract&>(), "Error!");
379
380 static_assert(!has_type<std::result_of<ident_functor(int(&&)[1])>>(), "Error!");
381 static_assert(!has_type<std::result_of<ident_functor(Abstract&&)>>(), "Error!");
382 static_assert(!has_type<std::result_of<ident_functor(const int(&&)[1])>>(),
383 "Error!");
384 static_assert(!has_type<std::result_of<ident_functor(const Abstract&&)>>(),
385 "Error!");
386 static_assert(!has_type<std::result_of<ident_functor_noref(int(&)[1])>>(),
387 "Error!");
388 static_assert(!has_type<std::result_of<ident_functor_noref
389 (const int(&)[1])>>(), "Error!");
390 static_assert(!has_type<std::result_of<ident_functor_noref(Abstract&)>>(),
391 "Error!");
392 static_assert(!has_type<std::result_of
393 <ident_functor_noref(const Abstract&)>>(), "Error!");
394 static_assert(!has_type<std::result_of<ident_functor_noref(void(&)())>>(),
395 "Error!");
396 static_assert(!has_type<std::result_of<ident_functor_noref(void(&&)())>>(),
397 "Error!");
398
399 static_assert(!has_type<std::result_of<ident_functor()>>(), "Error!");
400 static_assert(!has_type<std::result_of<ident_functor(int, int)>>(), "Error!");
401 static_assert(!has_type<std::result_of<const ident_functor&(int)>>(), "Error!");
402 static_assert(!has_type<std::result_of<const ident_functor&&(int)>>(),
403 "Error!");
404
405 // Border-line case:
406 static_assert(!has_type<std::result_of<int S::*(Ukn*)>>(), "Error!");
407 static_assert(!has_type<std::result_of<void (S::*(Ukn*))()>>(), "Error!");
408
409 // We want to allow this, it seems to be required by the order described
410 // in [func.require] p1:
411 static_assert(is_type<std::result_of<int S::*(BadSmartPtr<S>&)>, int&>(),
412 "Error!");
413
414 static_assert(is_type<std::result_of<Private(std::nullptr_t)>, bool>(),
415 "Error!");
416 static_assert(is_type<std::result_of<Private&(std::nullptr_t)>, bool>(),
417 "Error!");
418 static_assert(is_type<std::result_of<Private&&(std::nullptr_t)>, bool>(),
419 "Error!");
420 static_assert(is_type<std::result_of<Private(ImplicitTo<std::nullptr_t>)>,
421 bool>(), "Error!");
422 static_assert(is_type<std::result_of<Private&(ImplicitTo<std::nullptr_t>)>,
423 bool>(), "Error!");
424 static_assert(is_type<std::result_of<Private&&(ImplicitTo<std::nullptr_t>)>,
425 bool>(), "Error!");
426
427 static_assert(!has_type<std::result_of<const Private&(std::nullptr_t)>>(),
428 "Error!");
429 static_assert(!has_type<std::result_of<const Private&&(std::nullptr_t)>>(),
430 "Error!");
431 static_assert(!has_type<std::result_of<Private()>>(), "Error!");
432 static_assert(!has_type<std::result_of<Private(int)>>(), "Error!");
433 static_assert(!has_type<std::result_of<Private(int, int)>>(), "Error!");
434 static_assert(!has_type<std::result_of<Private&()>>(), "Error!");
435 static_assert(!has_type<std::result_of<Private&(int)>>(), "Error!");
436 static_assert(!has_type<std::result_of<Private&(int, int)>>(), "Error!");
437 static_assert(!has_type<std::result_of<const Private&()>>(), "Error!");
438 static_assert(!has_type<std::result_of<const Private&(int)>>(), "Error!");
439 static_assert(!has_type<std::result_of<const Private&(int, int)>>(), "Error!");
440 static_assert(!has_type<std::result_of<Private&&()>>(), "Error!");
441 static_assert(!has_type<std::result_of<Private&&(int)>>(), "Error!");
442 static_assert(!has_type<std::result_of<Private&&(int, int)>>(), "Error!");
443 static_assert(!has_type<std::result_of<const Private&&()>>(), "Error!");
444 static_assert(!has_type<std::result_of<const Private&&(int)>>(), "Error!");
445 static_assert(!has_type<std::result_of<const Private&&(int, int)>>(), "Error!");
446
447 static_assert(!has_type<std::result_of<Private(ScEn)>>(), "Error!");
448 static_assert(!has_type<std::result_of<Private(UnScEn)>>(), "Error!");
449 static_assert(!has_type<std::result_of<const Private&(ScEn)>>(), "Error!");
450 static_assert(!has_type<std::result_of<const Private&(UnScEn)>>(), "Error!");
451 static_assert(!has_type<std::result_of<Private(ImplicitTo<ScEn>)>>(), "Error!");
452 static_assert(!has_type<std::result_of<Private(ImplicitTo<UnScEn>)>>(),
453 "Error!");
454 static_assert(!has_type<std::result_of<const Private&(ImplicitTo<ScEn>)>>(),
455 "Error!");
456 static_assert(!has_type<std::result_of<const Private&(ImplicitTo<UnScEn>)>>(),
457 "Error!");
458
459 static_assert(is_type<std::result_of<PrivateUnion(std::nullptr_t)>, bool>(),
460 "Error!");
461 static_assert(is_type<std::result_of<PrivateUnion&(std::nullptr_t)>, bool>(),
462 "Error!");
463 static_assert(is_type<std::result_of<PrivateUnion&&(std::nullptr_t)>, bool>(),
464 "Error!");
465 static_assert(is_type<std::result_of<PrivateUnion(ImplicitTo<std::nullptr_t>)>,
466 bool>(), "Error!");
467 static_assert(is_type<std::result_of
468 <PrivateUnion&(ImplicitTo<std::nullptr_t>)>, bool>(), "Error!");
469 static_assert(is_type<std::result_of
470 <PrivateUnion&&(ImplicitTo<std::nullptr_t>)>, bool>(), "Error!");
471
472 static_assert(!has_type<std::result_of<const PrivateUnion&(std::nullptr_t)>>(),
473 "Error!");
474 static_assert(!has_type<std::result_of
475 <const PrivateUnion&&(std::nullptr_t)>>(), "Error!");
476 static_assert(!has_type<std::result_of<PrivateUnion()>>(), "Error!");
477 static_assert(!has_type<std::result_of<PrivateUnion(int)>>(), "Error!");
478 static_assert(!has_type<std::result_of<PrivateUnion(int, int)>>(), "Error!");
479 static_assert(!has_type<std::result_of<PrivateUnion&()>>(), "Error!");
480 static_assert(!has_type<std::result_of<PrivateUnion&(int)>>(), "Error!");
481 static_assert(!has_type<std::result_of<PrivateUnion&(int, int)>>(), "Error!");
482 static_assert(!has_type<std::result_of<const PrivateUnion&()>>(), "Error!");
483 static_assert(!has_type<std::result_of<const PrivateUnion&(int)>>(), "Error!");
484 static_assert(!has_type<std::result_of<const PrivateUnion&(int, int)>>(),
485 "Error!");
486 static_assert(!has_type<std::result_of<PrivateUnion&&()>>(), "Error!");
487 static_assert(!has_type<std::result_of<PrivateUnion&&(int)>>(), "Error!");
488 static_assert(!has_type<std::result_of<PrivateUnion&&(int, int)>>(), "Error!");
489 static_assert(!has_type<std::result_of<const PrivateUnion&&()>>(), "Error!");
490 static_assert(!has_type<std::result_of<const PrivateUnion&&(int)>>(), "Error!");
491 static_assert(!has_type<std::result_of<const PrivateUnion&&(int, int)>>(),
492 "Error!");
493
494 static_assert(!has_type<std::result_of<PrivateUnion(ScEn)>>(), "Error!");
495 static_assert(!has_type<std::result_of<PrivateUnion(UnScEn)>>(), "Error!");
496 static_assert(!has_type<std::result_of<const PrivateUnion&(ScEn)>>(), "Error!");
497 static_assert(!has_type<std::result_of<const PrivateUnion&(UnScEn)>>(),
498 "Error!");
499 static_assert(!has_type<std::result_of<PrivateUnion(ImplicitTo<ScEn>)>>(),
500 "Error!");
501 static_assert(!has_type<std::result_of<PrivateUnion(ImplicitTo<UnScEn>)>>(),
502 "Error!");
503 static_assert(!has_type<std::result_of
504 <const PrivateUnion&(ImplicitTo<ScEn>)>>(), "Error!");
505 static_assert(!has_type<std::result_of
506 <const PrivateUnion&(ImplicitTo<UnScEn>)>>(), "Error!");
507
508 static_assert(is_type<std::result_of<void(*(bool))(int)>, void>(), "Error!");
509 static_assert(is_type<std::result_of<void(*(UnScEn))(int)>, void>(), "Error!");
510 static_assert(is_type<std::result_of<void(*(ImplicitTo<int>))(int)>, void>(),
511 "Error!");
512 static_assert(is_type<std::result_of<void(*(ImplicitTo<int>&))(int)>, void>(),
513 "Error!");
514 static_assert(is_type<std::result_of<void(*(ImplicitTo<int>&&))(int)>, void>(),
515 "Error!");
516
517 static_assert(!has_type<std::result_of<void(*(ScEn))(int)>>(), "Error!");
518 static_assert(!has_type<std::result_of
519 <void(*(const ImplicitTo<int>&))(int)>>(), "Error!");
520 static_assert(!has_type<std::result_of
521 <void(*(const ImplicitTo<int>&&))(int)>>(), "Error!");
522
523 static_assert(is_type<std::result_of<ImplicitTo<void(*)()>()>, void>(),
524 "Error!");
525 static_assert(is_type<std::result_of<ImplicitTo<void(&)()>()>, void>(),
526 "Error!");
527
528 static_assert(!has_type<std::result_of<ImplicitTo<void(*)()>(int)>>(),
529 "Error!");
530 static_assert(!has_type<std::result_of<ImplicitTo<void(*)(int)>()>>(),
531 "Error!");
532 static_assert(!has_type<std::result_of<ImplicitTo<void(&)()>(int)>>(),
533 "Error!");
534 static_assert(!has_type<std::result_of<ImplicitTo<void(&)(int)>()>>(),
535 "Error!");
536
537 // Conversion operators of types are not considered in call expressions
538 // (except for conversion to function pointer/reference):
539 static_assert(!has_type<std::result_of<ImplicitTo<S>(char, int&)>>(), "Error!");
540 static_assert(!has_type<std::result_of<ImplicitTo<ident_functor>(int)>>(),
541 "Error!");
542
543 static_assert(is_type<std::result_of<variable_functor<>()>, void>(), "Error!");
544 static_assert(is_type<std::result_of<variable_functor<>(int)>, void>(),
545 "Error!");
546 static_assert(is_type<std::result_of<variable_functor<>(int, int)>, void>(),
547 "Error!");
548 static_assert(is_type<std::result_of<variable_functor<>(int, int, int)>,
549 void>(), "Error!");
550
551 static_assert(is_type<std::result_of<variable_functor<>&()>, void>(), "Error!");
552 static_assert(is_type<std::result_of<variable_functor<>&(int)>, void>(),
553 "Error!");
554 static_assert(is_type<std::result_of<variable_functor<>&(int, int)>, void>(),
555 "Error!");
556 static_assert(is_type<std::result_of<variable_functor<>&(int, int, int)>,
557 void>(), "Error!");
558
559 static_assert(!has_type<std::result_of<const variable_functor<>()>>(),
560 "Error!");
561 static_assert(!has_type<std::result_of<const variable_functor<>(int)>>(),
562 "Error!");
563 static_assert(!has_type<std::result_of<const variable_functor<>(int, int)>>(),
564 "Error!");
565 static_assert(!has_type<std::result_of
566 <const variable_functor<>(int, int, int)>>(), "Error!");
567
568 static_assert(!has_type<std::result_of<const variable_functor<>&()>>(),
569 "Error!");
570 static_assert(!has_type<std::result_of<const variable_functor<>&(int)>>(),
571 "Error!");
572 static_assert(!has_type<std::result_of
573 <const variable_functor<>&(int, int)>>(), "Error!");
574 static_assert(!has_type<std::result_of
575 <const variable_functor<>&(int, int, int)>>(), "Error!");
576
577 static_assert(is_type<std::result_of<variable_functor<S>()>, S>(), "Error!");
578 static_assert(is_type<std::result_of<variable_functor<S>(int)>, S>(), "Error!");
579 static_assert(is_type<std::result_of<variable_functor<S>(int, int)>, S>(),
580 "Error!");
581 static_assert(is_type<std::result_of<variable_functor<S>(int, int, int)>, S>(),
582 "Error!");
583
584 static_assert(is_type<std::result_of<variable_functor<S>&()>, S>(), "Error!");
585 static_assert(is_type<std::result_of<variable_functor<S>&(int)>, S>(),
586 "Error!");
587 static_assert(is_type<std::result_of<variable_functor<S>&(int, int)>, S>(),
588 "Error!");
589 static_assert(is_type<std::result_of
590 <variable_functor<S>&(int, int, int)>, S>(), "Error!");
591
592 static_assert(!has_type<std::result_of
593 <const variable_functor<S>()>>(), "Error!");
594 static_assert(!has_type<std::result_of
595 <const variable_functor<S>(int)>>(), "Error!");
596 static_assert(!has_type<std::result_of
597 <const variable_functor<S>(int, int)>>(), "Error!");
598 static_assert(!has_type<std::result_of
599 <const variable_functor<S>(int, int, int)>>(), "Error!");
600
601 static_assert(!has_type<std::result_of<const variable_functor<S>&()>>(),
602 "Error!");
603 static_assert(!has_type<std::result_of<const variable_functor<S>&(int)>>(),
604 "Error!");
605 static_assert(!has_type<std::result_of
606 <const variable_functor<S>&(int, int)>>(), "Error!");
607 static_assert(!has_type<std::result_of
608 <const variable_functor<S>&(int, int, int)>>(), "Error!");
609
610 #if defined(HAS_52748_FIXED)
611 static_assert(has_type<std::result_of<variable_functor<Ukn>()>>(), "Error!");
612 static_assert(is_type<std::result_of<variable_functor<Ukn>()>, Ukn>(),
613 "Error!");
614 static_assert(is_type<std::result_of<variable_functor<Ukn>(int)>, Ukn>(),
615 "Error!");
616 static_assert(is_type<std::result_of<variable_functor<Ukn>(int, int)>, Ukn>(),
617 "Error!");
618 static_assert(is_type<std::result_of
619 <variable_functor<Ukn>(int, int, int)>, Ukn>(), "Error!");
620
621 static_assert(is_type<std::result_of<variable_functor<Ukn>&()>, Ukn>(),
622 "Error!");
623 static_assert(is_type<std::result_of<variable_functor<Ukn>&(int)>, Ukn>(),
624 "Error!");
625 static_assert(is_type<std::result_of
626 <variable_functor<Ukn>&(int, int)>, Ukn>(), "Error!");
627 static_assert(is_type<std::result_of
628 <variable_functor<Ukn>&(int, int, int)>, Ukn>(), "Error!");
629
630 static_assert(is_type<std::result_of<PMSIncomplete(int)>, Ukn>(), "Error!");
631 static_assert(is_type<std::result_of<PMSIncomplete&(int)>, Ukn>(), "Error!");
632 static_assert(is_type<std::result_of<PMSIncomplete&&(int)>, Ukn>(), "Error!");
633
634 static_assert(is_type<std::result_of<FuncIncomplete(int)>, Ukn>(), "Error!");
635 static_assert(is_type<std::result_of<FuncIncomplete&(int)>, Ukn>(), "Error!");
636 static_assert(is_type<std::result_of<FuncIncomplete&&(int)>, Ukn>(), "Error!");
637
638 static_assert(is_type<std::result_of<FuncEllipses<Ukn>*()>, Ukn>(), "Error!");
639 static_assert(is_type<std::result_of<FuncEllipses<Ukn>&()>, Ukn>(), "Error!");
640 static_assert(is_type<std::result_of<FuncEllipses<Ukn>&&()>, Ukn>(), "Error!");
641
642 static_assert(is_type<std::result_of<FuncEllipses<Ukn>*(bool)>, Ukn>(),
643 "Error!");
644 static_assert(is_type<std::result_of<FuncEllipses<Ukn>&(bool)>, Ukn>(),
645 "Error!");
646 static_assert(is_type<std::result_of<FuncEllipses<Ukn>&&(bool)>, Ukn>(),
647 "Error!");
648
649 static_assert(is_type<std::result_of<FuncEllipses<Ukn>*(bool, int, S)>, Ukn>(),
650 "Error!");
651 static_assert(is_type<std::result_of<FuncEllipses<Ukn>&(bool, int, S)>, Ukn>(),
652 "Error!");
653 static_assert(is_type<std::result_of
654 <FuncEllipses<Ukn>&&(bool, int, S)>, Ukn>(), "Error!");
655
656 static_assert(!has_type<std::result_of<PMSIncompletenonconst(const S*)>>(),
657 "Error!");
658 static_assert(!has_type<std::result_of
659 <PMSIncompletenonconst(const S*, int)>>(), "Error!");
660 static_assert(!has_type<std::result_of
661 <PMSIncompletenonconst(const S*, int, int)>>(), "Error!");
662 static_assert(!has_type<std::result_of
663 <PMSIncompletenonconst(const S*, int, int, int)>>(), "Error!");
664 static_assert(!has_type<std::result_of
665 <PMSIncompletenonconst(const S*&)>>(), "Error!");
666 static_assert(!has_type<std::result_of
667 <PMSIncompletenonconst(const S*&, int)>>(), "Error!");
668 static_assert(!has_type<std::result_of
669 <PMSIncompletenonconst(const S*&, int, int)>>(), "Error!");
670 static_assert(!has_type<std::result_of
671 <PMSIncompletenonconst(const S*&, int, int, int)>>(), "Error!");
672
673 static_assert(!has_type<std::result_of
674 <PMSIncompletenonconst(const S&)>>(), "Error!");
675 static_assert(!has_type<std::result_of
676 <PMSIncompletenonconst(const S&, int)>>(), "Error!");
677 static_assert(!has_type<std::result_of
678 <PMSIncompletenonconst(const S&, int, int)>>(), "Error!");
679 static_assert(!has_type<std::result_of
680 <PMSIncompletenonconst(const S&, int, int, int)>>(), "Error!");
681 static_assert(!has_type<std::result_of
682 <PMSIncompletenonconst(const S&&)>>(), "Error!");
683 static_assert(!has_type<std::result_of
684 <PMSIncompletenonconst(const S&&, int)>>(), "Error!");
685 static_assert(!has_type<std::result_of
686 <PMSIncompletenonconst(const S&&, int, int)>>(), "Error!");
687 static_assert(!has_type<std::result_of
688 <PMSIncompletenonconst(const S&&, int, int, int)>>(), "Error!");
689 #endif
690
691 static_assert(!has_type<std::result_of<const variable_functor<Ukn>()>>(),
692 "Error!");
693 static_assert(!has_type<std::result_of<const variable_functor<Ukn>(int)>>(),
694 "Error!");
695 static_assert(!has_type<std::result_of
696 <const variable_functor<Ukn>(int, int)>>(), "Error!");
697 static_assert(!has_type<std::result_of
698 <const variable_functor<Ukn>(int, int, int)>>(), "Error!");
699
700 static_assert(!has_type<std::result_of<const variable_functor<Ukn>&()>>(),
701 "Error!");
702 static_assert(!has_type<std::result_of<const variable_functor<Ukn>&(int)>>(),
703 "Error!");
704 static_assert(!has_type<std::result_of
705 <const variable_functor<Ukn>&(int, int)>>(), "Error!");
706 static_assert(!has_type<std::result_of
707 <const variable_functor<Ukn>&(int, int, int)>>(), "Error!");
708
709 static_assert(!has_type<std::result_of<FuncIncomplete()>>(), "Error!");
710 static_assert(!has_type<std::result_of<FuncIncomplete(S)>>(), "Error!");
711 static_assert(!has_type<std::result_of<FuncIncomplete(int, int)>>(), "Error!");
712 static_assert(!has_type<std::result_of<FuncIncomplete(int, int, int)>>(),
713 "Error!");
714
715 static_assert(!has_type<std::result_of<FuncIncomplete&&()>>(), "Error!");
716 static_assert(!has_type<std::result_of<FuncIncomplete&&(S)>>(), "Error!");
717 static_assert(!has_type<std::result_of<FuncIncomplete&&(int, int)>>(),
718 "Error!");
719 static_assert(!has_type<std::result_of<FuncIncomplete&&(int, int, int)>>(),
720 "Error!");
721
722 static_assert(is_type<std::result_of<FuncEllipses<int>*()>, int>(), "Error!");
723 static_assert(is_type<std::result_of<FuncEllipses<int>&()>, int>(), "Error!");
724 static_assert(is_type<std::result_of<FuncEllipses<int>&&()>, int>(), "Error!");
725
726 static_assert(is_type<std::result_of<FuncEllipses<int>*(bool)>, int>(),
727 "Error!");
728 static_assert(is_type<std::result_of<FuncEllipses<int>&(bool)>, int>(),
729 "Error!");
730 static_assert(is_type<std::result_of<FuncEllipses<int>&&(bool)>, int>(),
731 "Error!");
732
733 static_assert(is_type<std::result_of<FuncEllipses<int>*(bool, int, S)>, int>(),
734 "Error!");
735 static_assert(is_type<std::result_of<FuncEllipses<int>&(bool, int, S)>, int>(),
736 "Error!");
737 static_assert(is_type<std::result_of
738 <FuncEllipses<int>&&(bool, int, S)>, int>(), "Error!");
739