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