1*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
2*0a6a1f1dSLionel Sambuc //
3*0a6a1f1dSLionel Sambuc // The LLVM Compiler Infrastructure
4*0a6a1f1dSLionel Sambuc //
5*0a6a1f1dSLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
6*0a6a1f1dSLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
7*0a6a1f1dSLionel Sambuc //
8*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel Sambuc // [func.require]
11*0a6a1f1dSLionel Sambuc
12*0a6a1f1dSLionel Sambuc // INVOKE
13*0a6a1f1dSLionel Sambuc #if __cplusplus < 201103L
main()14*0a6a1f1dSLionel Sambuc int main () {} // no __invoke in C++03
15*0a6a1f1dSLionel Sambuc #else
16*0a6a1f1dSLionel Sambuc
17*0a6a1f1dSLionel Sambuc #include <type_traits>
18*0a6a1f1dSLionel Sambuc
19*0a6a1f1dSLionel Sambuc template <typename T, int N>
20*0a6a1f1dSLionel Sambuc struct Array
21*0a6a1f1dSLionel Sambuc {
22*0a6a1f1dSLionel Sambuc typedef T type[N];
23*0a6a1f1dSLionel Sambuc };
24*0a6a1f1dSLionel Sambuc
25*0a6a1f1dSLionel Sambuc struct Type
26*0a6a1f1dSLionel Sambuc {
27*0a6a1f1dSLionel Sambuc Array<char, 1>::type& f1();
28*0a6a1f1dSLionel Sambuc Array<char, 2>::type& f2() const;
29*0a6a1f1dSLionel Sambuc
30*0a6a1f1dSLionel Sambuc Array<char, 1>::type& g1() &;
31*0a6a1f1dSLionel Sambuc Array<char, 2>::type& g2() const &;
32*0a6a1f1dSLionel Sambuc #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
33*0a6a1f1dSLionel Sambuc Array<char, 3>::type& g3() &&;
34*0a6a1f1dSLionel Sambuc Array<char, 4>::type& g4() const &&;
35*0a6a1f1dSLionel Sambuc #endif
36*0a6a1f1dSLionel Sambuc };
37*0a6a1f1dSLionel Sambuc
main()38*0a6a1f1dSLionel Sambuc int main()
39*0a6a1f1dSLionel Sambuc {
40*0a6a1f1dSLionel Sambuc static_assert(sizeof(std::__invoke(&Type::f1, std::declval<Type >())) == 1, "");
41*0a6a1f1dSLionel Sambuc static_assert(sizeof(std::__invoke(&Type::f2, std::declval<Type const >())) == 2, "");
42*0a6a1f1dSLionel Sambuc
43*0a6a1f1dSLionel Sambuc static_assert(sizeof(std::__invoke(&Type::g1, std::declval<Type &>())) == 1, "");
44*0a6a1f1dSLionel Sambuc static_assert(sizeof(std::__invoke(&Type::g2, std::declval<Type const &>())) == 2, "");
45*0a6a1f1dSLionel Sambuc #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
46*0a6a1f1dSLionel Sambuc static_assert(sizeof(std::__invoke(&Type::g3, std::declval<Type &&>())) == 3, "");
47*0a6a1f1dSLionel Sambuc static_assert(sizeof(std::__invoke(&Type::g4, std::declval<Type const&&>())) == 4, "");
48*0a6a1f1dSLionel Sambuc #endif
49*0a6a1f1dSLionel Sambuc }
50*0a6a1f1dSLionel Sambuc #endif
51