1 // { dg-options "-std=gnu++11" }
4 // Copyright (C) 2012-2013 Free Software Foundation, Inc.
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)
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/>.
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
32 template<typename T
, typename
= typename
T::type
>
33 static std::true_type
test(int);
36 static std::false_type
test(...);
40 struct has_type
: public decltype(has_type_impl::test
<T
>(0))
43 template<typename T
, typename Res
>
44 struct is_expected_type
: public std::is_same
<typename
T::type
, Res
>
47 template<typename P1
, typename P2
>
48 struct and_
: public std::conditional
<P1::value
, P2
, std::false_type
>::type
51 template<typename T
, typename Res
>
52 struct is_type
: public and_
<has_type
<T
>, is_expected_type
<T
, Res
>>
55 // Types under inspection:
57 typedef bool (&PF1
)();
58 typedef short (*PF2
)(long);
62 double operator()(char, int&);
63 void calc(long) const;
66 typedef void (S::*PMS
)(long) const;
67 typedef void (S::*PMSnonconst
)(long);
74 bool f2(int) const volatile;
79 typedef void (B::*base_func_void
)() const;
80 typedef bool (B::*base_func_bool_int
)(int) const volatile;
82 struct ident_functor
{
87 template<typename Ret
= void>
88 struct variable_functor
{
89 template<typename
... T
>
90 Ret
operator()(T
&&...);
93 struct ident_functor_noref
{
95 typename
std::remove_reference
<T
>::type
operator()(T
&& x
);
110 void operator()() const;
111 int operator()(double) const;
112 bool operator()(double);
113 U
operator()(int, int);
118 typedef Ukn (S::*PMSIncomplete
)(long) const;
119 typedef Ukn (S::*PMSIncompletenonconst
)(long);
120 typedef Ukn (*FuncIncomplete
)(long);
123 virtual ~Abstract() = 0;
131 bool operator()(std::nullptr_t
);
140 bool operator()(std::nullptr_t
);
149 struct never
{ static const bool value
= false; };
153 static_assert(never
<T
>::value
, "Error!");
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
,
236 static_assert(!has_type
<std::result_of
<base_func_void(volatile B
*)>>::value
,
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>(),
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)>>(),
269 static_assert(!has_type
<std::result_of
<PMS(std::unique_ptr
<S
>&, int, bool)>>(),
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
)>>(),
279 static_assert(!has_type
<std::result_of
<PMS(std::unique_ptr
<S
>&, S
)>>(),
281 static_assert(!has_type
<std::result_of
<PMS(S
, S
)>>(), "Error!");
282 static_assert(!has_type
<std::result_of
<PMS(S
&, S
)>>(), "Error!");
285 static_assert(!has_type
<std::result_of
<PMSnonconst(const S
&, long)>>(),
287 static_assert(!has_type
<std::result_of
<PMSnonconst(const S
&&, long)>>(),
289 static_assert(!has_type
<std::result_of
<PMSnonconst(const S
*, long)>>(),
291 static_assert(!has_type
<std::result_of
<PMSnonconst(const S
*&, long)>>(),
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&>(),
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&>(),
323 static_assert(is_type
<std::result_of
<int Ukn::*(const Ukn
&)>, const int&>(),
325 static_assert(is_type
<std::result_of
<int Ukn::*(const Ukn
&&)>, const int&&>(),
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>(),
339 static_assert(is_type
<std::result_of
<PUfnConstMF(const Ukn
&)>, void>(),
341 static_assert(is_type
<std::result_of
<PUfnConstMF(const Ukn
&&)>, void>(),
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)>,
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&&)>,
376 static_assert(is_type
<std::result_of
<ident_functor(Abstract
&)>, Abstract
&>(),
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])>>(),
385 static_assert(!has_type
<std::result_of
<ident_functor(const Abstract
&&)>>(),
387 static_assert(!has_type
<std::result_of
<ident_functor_noref(int(&)[1])>>(),
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
&)>>(),
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(&)())>>(),
397 static_assert(!has_type
<std::result_of
<ident_functor_noref(void(&&)())>>(),
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)>>(),
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&>(),
415 static_assert(is_type
<std::result_of
<Private(std::nullptr_t
)>, bool>(),
417 static_assert(is_type
<std::result_of
<Private
&(std::nullptr_t
)>, bool>(),
419 static_assert(is_type
<std::result_of
<Private
&&(std::nullptr_t
)>, bool>(),
421 static_assert(is_type
<std::result_of
<Private(ImplicitTo
<std::nullptr_t
>)>,
423 static_assert(is_type
<std::result_of
<Private
&(ImplicitTo
<std::nullptr_t
>)>,
425 static_assert(is_type
<std::result_of
<Private
&&(ImplicitTo
<std::nullptr_t
>)>,
428 static_assert(!has_type
<std::result_of
<const Private
&(std::nullptr_t
)>>(),
430 static_assert(!has_type
<std::result_of
<const Private
&&(std::nullptr_t
)>>(),
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
>)>>(),
455 static_assert(!has_type
<std::result_of
<const Private
&(ImplicitTo
<ScEn
>)>>(),
457 static_assert(!has_type
<std::result_of
<const Private
&(ImplicitTo
<UnScEn
>)>>(),
460 static_assert(is_type
<std::result_of
<PrivateUnion(std::nullptr_t
)>, bool>(),
462 static_assert(is_type
<std::result_of
<PrivateUnion
&(std::nullptr_t
)>, bool>(),
464 static_assert(is_type
<std::result_of
<PrivateUnion
&&(std::nullptr_t
)>, bool>(),
466 static_assert(is_type
<std::result_of
<PrivateUnion(ImplicitTo
<std::nullptr_t
>)>,
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
)>>(),
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)>>(),
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)>>(),
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
)>>(),
500 static_assert(!has_type
<std::result_of
<PrivateUnion(ImplicitTo
<ScEn
>)>>(),
502 static_assert(!has_type
<std::result_of
<PrivateUnion(ImplicitTo
<UnScEn
>)>>(),
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>(),
513 static_assert(is_type
<std::result_of
<void(*(ImplicitTo
<int>&))(int)>, void>(),
515 static_assert(is_type
<std::result_of
<void(*(ImplicitTo
<int>&&))(int)>, void>(),
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>(),
526 static_assert(is_type
<std::result_of
<ImplicitTo
<void(&)()>()>, void>(),
529 static_assert(!has_type
<std::result_of
<ImplicitTo
<void(*)()>(int)>>(),
531 static_assert(!has_type
<std::result_of
<ImplicitTo
<void(*)(int)>()>>(),
533 static_assert(!has_type
<std::result_of
<ImplicitTo
<void(&)()>(int)>>(),
535 static_assert(!has_type
<std::result_of
<ImplicitTo
<void(&)(int)>()>>(),
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)>>(),
544 static_assert(is_type
<std::result_of
<variable_functor
<>()>, void>(), "Error!");
545 static_assert(is_type
<std::result_of
<variable_functor
<>(int)>, void>(),
547 static_assert(is_type
<std::result_of
<variable_functor
<>(int, int)>, void>(),
549 static_assert(is_type
<std::result_of
<variable_functor
<>(int, int, int)>,
552 static_assert(is_type
<std::result_of
<variable_functor
<>&()>, void>(), "Error!");
553 static_assert(is_type
<std::result_of
<variable_functor
<>&(int)>, void>(),
555 static_assert(is_type
<std::result_of
<variable_functor
<>&(int, int)>, void>(),
557 static_assert(is_type
<std::result_of
<variable_functor
<>&(int, int, int)>,
560 static_assert(!has_type
<std::result_of
<const variable_functor
<>()>>(),
562 static_assert(!has_type
<std::result_of
<const variable_functor
<>(int)>>(),
564 static_assert(!has_type
<std::result_of
<const variable_functor
<>(int, int)>>(),
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
<>&()>>(),
571 static_assert(!has_type
<std::result_of
<const variable_functor
<>&(int)>>(),
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
>(),
582 static_assert(is_type
<std::result_of
<variable_functor
<S
>(int, int, int)>, S
>(),
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
>(),
588 static_assert(is_type
<std::result_of
<variable_functor
<S
>&(int, int)>, S
>(),
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
>&()>>(),
604 static_assert(!has_type
<std::result_of
<const variable_functor
<S
>&(int)>>(),
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
>(),
615 static_assert(is_type
<std::result_of
<variable_functor
<Ukn
>(int)>, Ukn
>(),
617 static_assert(is_type
<std::result_of
<variable_functor
<Ukn
>(int, int)>, Ukn
>(),
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
>(),
624 static_assert(is_type
<std::result_of
<variable_functor
<Ukn
>&(int)>, Ukn
>(),
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
>(),
645 static_assert(is_type
<std::result_of
<FuncEllipses
<Ukn
>&(bool)>, Ukn
>(),
647 static_assert(is_type
<std::result_of
<FuncEllipses
<Ukn
>&&(bool)>, Ukn
>(),
650 static_assert(is_type
<std::result_of
<FuncEllipses
<Ukn
>*(bool, int, S
)>, Ukn
>(),
652 static_assert(is_type
<std::result_of
<FuncEllipses
<Ukn
>&(bool, int, S
)>, Ukn
>(),
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
*)>>(),
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!");
692 static_assert(!has_type
<std::result_of
<const variable_functor
<Ukn
>()>>(),
694 static_assert(!has_type
<std::result_of
<const variable_functor
<Ukn
>(int)>>(),
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
>&()>>(),
703 static_assert(!has_type
<std::result_of
<const variable_functor
<Ukn
>&(int)>>(),
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)>>(),
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)>>(),
720 static_assert(!has_type
<std::result_of
<FuncIncomplete
&&(int, int, int)>>(),
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>(),
729 static_assert(is_type
<std::result_of
<FuncEllipses
<int>&(bool)>, int>(),
731 static_assert(is_type
<std::result_of
<FuncEllipses
<int>&&(bool)>, int>(),
734 static_assert(is_type
<std::result_of
<FuncEllipses
<int>*(bool, int, S
)>, int>(),
736 static_assert(is_type
<std::result_of
<FuncEllipses
<int>&(bool, int, S
)>, int>(),
738 static_assert(is_type
<std::result_of
739 <FuncEllipses
<int>&&(bool, int, S
)>, int>(), "Error!");