]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/result_of/sfinae_friendly_1.cc
1 // { dg-do compile { target c++11 } }
3 // Copyright (C) 2012-2016 Free Software Foundation, Inc.
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)
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.
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/>.
22 #include <type_traits>
24 // TODO: Uncomment the following define once gcc has fixed bug 52748
25 // (incomplete types in function call expressions):
26 //#define HAS_52748_FIXED
31 template<typename T
, typename
= typename
T::type
>
32 static std::true_type
test(int);
35 static std::false_type
test(...);
39 struct has_type
: public decltype(has_type_impl::test
<T
>(0))
42 template<typename T
, typename Res
>
43 struct is_expected_type
: public std::is_same
<typename
T::type
, Res
>
46 template<typename P1
, typename P2
>
47 struct and_
: public std::conditional
<P1::value
, P2
, std::false_type
>::type
50 template<typename T
, typename Res
>
51 struct is_type
: public and_
<has_type
<T
>, is_expected_type
<T
, Res
>>
54 // Types under inspection:
56 typedef bool (&PF1
)();
57 typedef short (*PF2
)(long);
61 double operator()(char, int&);
62 void calc(long) const;
65 typedef void (S::*PMS
)(long) const;
66 typedef void (S::*PMSnonconst
)(long);
73 bool f2(int) const volatile;
78 typedef void (B::*base_func_void
)() const;
79 typedef bool (B::*base_func_bool_int
)(int) const volatile;
81 struct ident_functor
{
86 template<typename Ret
= void>
87 struct variable_functor
{
88 template<typename
... T
>
89 Ret
operator()(T
&&...);
92 struct ident_functor_noref
{
94 typename
std::remove_reference
<T
>::type
operator()(T
&& x
);
109 void operator()() const;
110 int operator()(double) const;
111 bool operator()(double);
112 U
operator()(int, int);
117 typedef Ukn (S::*PMSIncomplete
)(long) const;
118 typedef Ukn (S::*PMSIncompletenonconst
)(long);
119 typedef Ukn (*FuncIncomplete
)(long);
122 virtual ~Abstract() = 0;
130 bool operator()(std::nullptr_t
);
139 bool operator()(std::nullptr_t
);
148 struct never
{ static const bool value
= false; };
152 static_assert(never
<T
>::value
, "Error!");
157 struct BadSmartPtr
: T
{
158 T
& operator*() const noexcept(typename BrokenTrait
<T
>::type());
161 template<typename Ret
>
162 using FuncEllipses
= Ret(...);
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!");
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!");
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!");
196 static_assert(is_type
<std::result_of
<int B::*(B
&)>, int&>::value
, "Error!");
198 // This is expected as of CWG 616 P/R:
199 static_assert(is_type
<std::result_of
<int B::*(B
)>, int&&>::value
, "Error!");
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!");
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!");
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!");
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!");
233 static_assert(!has_type
<std::result_of
<base_func_void(volatile B
&)>>::value
,
235 static_assert(!has_type
<std::result_of
<base_func_void(volatile B
*)>>::value
,
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!");
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>(),
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!");
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)>>(),
268 static_assert(!has_type
<std::result_of
<PMS(std::unique_ptr
<S
>&, int, bool)>>(),
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!");
275 // Non-convertible arguments:
276 static_assert(!has_type
<std::result_of
<PMS(std::unique_ptr
<S
>, S
)>>(),
278 static_assert(!has_type
<std::result_of
<PMS(std::unique_ptr
<S
>&, S
)>>(),
280 static_assert(!has_type
<std::result_of
<PMS(S
, S
)>>(), "Error!");
281 static_assert(!has_type
<std::result_of
<PMS(S
&, S
)>>(), "Error!");
284 static_assert(!has_type
<std::result_of
<PMSnonconst(const S
&, long)>>(),
286 static_assert(!has_type
<std::result_of
<PMSnonconst(const S
&&, long)>>(),
288 static_assert(!has_type
<std::result_of
<PMSnonconst(const S
*, long)>>(),
290 static_assert(!has_type
<std::result_of
<PMSnonconst(const S
*&, long)>>(),
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!");
298 static_assert(!has_type
<std::result_of
<PMI()>>(), "Error!");
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!");
305 static_assert(!has_type
<std::result_of
<PMI(B
*)>>(), "Error!");
306 static_assert(!has_type
<std::result_of
<PMI(B
&)>>(), "Error!");
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&>(),
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!");
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&>(),
322 static_assert(is_type
<std::result_of
<int Ukn::*(const Ukn
&)>, const int&>(),
324 static_assert(is_type
<std::result_of
<int Ukn::*(const Ukn
&&)>, const int&&>(),
327 typedef void (Ukn::* PUfnMF
)();
328 typedef void (Ukn::* PUfnConstMF
)() const;
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>(),
338 static_assert(is_type
<std::result_of
<PUfnConstMF(const Ukn
&)>, void>(),
340 static_assert(is_type
<std::result_of
<PUfnConstMF(const Ukn
&&)>, void>(),
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!");
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!");
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!");
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)>,
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&&)>,
375 static_assert(is_type
<std::result_of
<ident_functor(Abstract
&)>, Abstract
&>(),
377 static_assert(is_type
<std::result_of
<ident_functor(const volatile Abstract
&)>,
378 const volatile Abstract
&>(), "Error!");
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])>>(),
384 static_assert(!has_type
<std::result_of
<ident_functor(const Abstract
&&)>>(),
386 static_assert(!has_type
<std::result_of
<ident_functor_noref(int(&)[1])>>(),
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
&)>>(),
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(&)())>>(),
396 static_assert(!has_type
<std::result_of
<ident_functor_noref(void(&&)())>>(),
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)>>(),
406 static_assert(!has_type
<std::result_of
<int S::*(Ukn
*)>>(), "Error!");
407 static_assert(!has_type
<std::result_of
<void (S::*(Ukn
*))()>>(), "Error!");
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&>(),
414 static_assert(is_type
<std::result_of
<Private(std::nullptr_t
)>, bool>(),
416 static_assert(is_type
<std::result_of
<Private
&(std::nullptr_t
)>, bool>(),
418 static_assert(is_type
<std::result_of
<Private
&&(std::nullptr_t
)>, bool>(),
420 static_assert(is_type
<std::result_of
<Private(ImplicitTo
<std::nullptr_t
>)>,
422 static_assert(is_type
<std::result_of
<Private
&(ImplicitTo
<std::nullptr_t
>)>,
424 static_assert(is_type
<std::result_of
<Private
&&(ImplicitTo
<std::nullptr_t
>)>,
427 static_assert(!has_type
<std::result_of
<const Private
&(std::nullptr_t
)>>(),
429 static_assert(!has_type
<std::result_of
<const Private
&&(std::nullptr_t
)>>(),
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!");
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
>)>>(),
454 static_assert(!has_type
<std::result_of
<const Private
&(ImplicitTo
<ScEn
>)>>(),
456 static_assert(!has_type
<std::result_of
<const Private
&(ImplicitTo
<UnScEn
>)>>(),
459 static_assert(is_type
<std::result_of
<PrivateUnion(std::nullptr_t
)>, bool>(),
461 static_assert(is_type
<std::result_of
<PrivateUnion
&(std::nullptr_t
)>, bool>(),
463 static_assert(is_type
<std::result_of
<PrivateUnion
&&(std::nullptr_t
)>, bool>(),
465 static_assert(is_type
<std::result_of
<PrivateUnion(ImplicitTo
<std::nullptr_t
>)>,
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!");
472 static_assert(!has_type
<std::result_of
<const PrivateUnion
&(std::nullptr_t
)>>(),
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)>>(),
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)>>(),
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
)>>(),
499 static_assert(!has_type
<std::result_of
<PrivateUnion(ImplicitTo
<ScEn
>)>>(),
501 static_assert(!has_type
<std::result_of
<PrivateUnion(ImplicitTo
<UnScEn
>)>>(),
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!");
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>(),
512 static_assert(is_type
<std::result_of
<void(*(ImplicitTo
<int>&))(int)>, void>(),
514 static_assert(is_type
<std::result_of
<void(*(ImplicitTo
<int>&&))(int)>, void>(),
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!");
523 static_assert(is_type
<std::result_of
<ImplicitTo
<void(*)()>()>, void>(),
525 static_assert(is_type
<std::result_of
<ImplicitTo
<void(&)()>()>, void>(),
528 static_assert(!has_type
<std::result_of
<ImplicitTo
<void(*)()>(int)>>(),
530 static_assert(!has_type
<std::result_of
<ImplicitTo
<void(*)(int)>()>>(),
532 static_assert(!has_type
<std::result_of
<ImplicitTo
<void(&)()>(int)>>(),
534 static_assert(!has_type
<std::result_of
<ImplicitTo
<void(&)(int)>()>>(),
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)>>(),
543 static_assert(is_type
<std::result_of
<variable_functor
<>()>, void>(), "Error!");
544 static_assert(is_type
<std::result_of
<variable_functor
<>(int)>, void>(),
546 static_assert(is_type
<std::result_of
<variable_functor
<>(int, int)>, void>(),
548 static_assert(is_type
<std::result_of
<variable_functor
<>(int, int, int)>,
551 static_assert(is_type
<std::result_of
<variable_functor
<>&()>, void>(), "Error!");
552 static_assert(is_type
<std::result_of
<variable_functor
<>&(int)>, void>(),
554 static_assert(is_type
<std::result_of
<variable_functor
<>&(int, int)>, void>(),
556 static_assert(is_type
<std::result_of
<variable_functor
<>&(int, int, int)>,
559 static_assert(!has_type
<std::result_of
<const variable_functor
<>()>>(),
561 static_assert(!has_type
<std::result_of
<const variable_functor
<>(int)>>(),
563 static_assert(!has_type
<std::result_of
<const variable_functor
<>(int, int)>>(),
565 static_assert(!has_type
<std::result_of
566 <const variable_functor
<>(int, int, int)>>(), "Error!");
568 static_assert(!has_type
<std::result_of
<const variable_functor
<>&()>>(),
570 static_assert(!has_type
<std::result_of
<const variable_functor
<>&(int)>>(),
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!");
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
>(),
581 static_assert(is_type
<std::result_of
<variable_functor
<S
>(int, int, int)>, S
>(),
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
>(),
587 static_assert(is_type
<std::result_of
<variable_functor
<S
>&(int, int)>, S
>(),
589 static_assert(is_type
<std::result_of
590 <variable_functor
<S
>&(int, int, int)>, S
>(), "Error!");
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!");
601 static_assert(!has_type
<std::result_of
<const variable_functor
<S
>&()>>(),
603 static_assert(!has_type
<std::result_of
<const variable_functor
<S
>&(int)>>(),
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!");
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
>(),
614 static_assert(is_type
<std::result_of
<variable_functor
<Ukn
>(int)>, Ukn
>(),
616 static_assert(is_type
<std::result_of
<variable_functor
<Ukn
>(int, int)>, Ukn
>(),
618 static_assert(is_type
<std::result_of
619 <variable_functor
<Ukn
>(int, int, int)>, Ukn
>(), "Error!");
621 static_assert(is_type
<std::result_of
<variable_functor
<Ukn
>&()>, Ukn
>(),
623 static_assert(is_type
<std::result_of
<variable_functor
<Ukn
>&(int)>, Ukn
>(),
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!");
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!");
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!");
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!");
642 static_assert(is_type
<std::result_of
<FuncEllipses
<Ukn
>*(bool)>, Ukn
>(),
644 static_assert(is_type
<std::result_of
<FuncEllipses
<Ukn
>&(bool)>, Ukn
>(),
646 static_assert(is_type
<std::result_of
<FuncEllipses
<Ukn
>&&(bool)>, Ukn
>(),
649 static_assert(is_type
<std::result_of
<FuncEllipses
<Ukn
>*(bool, int, S
)>, Ukn
>(),
651 static_assert(is_type
<std::result_of
<FuncEllipses
<Ukn
>&(bool, int, S
)>, Ukn
>(),
653 static_assert(is_type
<std::result_of
654 <FuncEllipses
<Ukn
>&&(bool, int, S
)>, Ukn
>(), "Error!");
656 static_assert(!has_type
<std::result_of
<PMSIncompletenonconst(const S
*)>>(),
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!");
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!");
691 static_assert(!has_type
<std::result_of
<const variable_functor
<Ukn
>()>>(),
693 static_assert(!has_type
<std::result_of
<const variable_functor
<Ukn
>(int)>>(),
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!");
700 static_assert(!has_type
<std::result_of
<const variable_functor
<Ukn
>&()>>(),
702 static_assert(!has_type
<std::result_of
<const variable_functor
<Ukn
>&(int)>>(),
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!");
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)>>(),
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)>>(),
719 static_assert(!has_type
<std::result_of
<FuncIncomplete
&&(int, int, int)>>(),
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!");
726 static_assert(is_type
<std::result_of
<FuncEllipses
<int>*(bool)>, int>(),
728 static_assert(is_type
<std::result_of
<FuncEllipses
<int>&(bool)>, int>(),
730 static_assert(is_type
<std::result_of
<FuncEllipses
<int>&&(bool)>, int>(),
733 static_assert(is_type
<std::result_of
<FuncEllipses
<int>*(bool, int, S
)>, int>(),
735 static_assert(is_type
<std::result_of
<FuncEllipses
<int>&(bool, int, S
)>, int>(),
737 static_assert(is_type
<std::result_of
738 <FuncEllipses
<int>&&(bool, int, S
)>, int>(), "Error!");