2 // { dg-lto-options { { -std=gnu++14 -flto -g -Wno-return-type } { -std=gnu++14 -flto -g -O2 -fno-inline -flto-partition=max -Wno-return-type } } }
3 // { dg-extra-ld-options "-r -nostdlib" }
6 inline namespace __cxx11 {}
7 template <typename _Tp, _Tp> struct integral_constant {
8 static constexpr _Tp value = 0;
10 template <typename> struct __and_;
11 struct is_member_object_pointer : integral_constant<bool, false> {};
13 struct is_member_function_pointer : integral_constant<bool, false> {};
14 template <typename> struct remove_reference { typedef int type; };
15 template <typename> class C;
16 template <bool, int, typename...> struct __result_of_impl;
17 template <typename _Functor, typename... _ArgTypes>
18 struct __result_of_impl<false, 0, _Functor, _ArgTypes...> {
19 typedef decltype(0) type;
21 template <typename _Functor, typename... _ArgTypes>
22 struct C<_Functor(_ArgTypes...)>
23 : __result_of_impl<is_member_object_pointer::value,
24 is_member_function_pointer<
25 typename remove_reference<_Functor>::type>::value,
27 template <typename _Tp> using result_of_t = typename C<_Tp>::type;
28 template <typename> void forward() { }
29 template <typename _Tp> _Tp move(_Tp) {}
31 class basic_string typedef string;
33 template <typename> struct allocator_traits { typedef decltype(0) pointer; };
35 struct F : std::allocator_traits<int> {};
40 struct _Alloc_hider : F {
41 _Alloc_hider(pointer);
43 basic_string(int) : _M_dataplus(0) {}
47 template <typename> class function;
48 template <typename _Functor> class _Base_manager {
50 static _Functor *_M_get_pointer(int) {}
52 template <typename, typename> class _Function_handler;
53 template <typename _Res, typename _Functor, typename... _ArgTypes>
54 class _Function_handler<_Res(_ArgTypes...), _Functor>
55 : _Base_manager<_Functor> {
57 static _Res _M_invoke(const int &) {
58 (*_Base_manager<_Functor>::_M_get_pointer(0))();
61 template <typename, typename> using __check_func_return_type = int;
62 template <typename _Res, typename... _ArgTypes>
63 class function<_Res(_ArgTypes...)> {
64 template <typename> using _Invoke = decltype(0);
65 template <typename _Functor>
66 using _Callable = __and_<__check_func_return_type<_Invoke<_Functor>, _Res>>;
67 template <typename, typename> using _Requires = int;
70 template <typename _Functor, typename = _Requires<_Callable<_Functor>, void>>
72 using _Invoker_type = _Res (*)(const int &);
73 _Invoker_type _M_invoker;
75 template <typename _Res, typename... _ArgTypes>
76 template <typename _Functor, typename>
77 function<_Res(_ArgTypes...)>::function(_Functor) {
78 _M_invoker = _Function_handler<_Res(), _Functor>::_M_invoke;
84 template <typename _Tp, typename... _Args> _Tp make_unique(_Args... __args) {
90 template <class T> T as();
94 A operator[](std::basic_string);
98 variables_map configuration();
99 void run(int, int, std::function<void()>);
107 std::unique_ptr _task;
108 template <typename Func> void schedule(Func func) {
109 struct task_with_state {
110 task_with_state(Func func) : _func(func) {}
112 } tws = std::make_unique<task_with_state>(std::move(func));
116 template <typename> using futurize_t = H;
119 template <typename Func> void schedule(Func func) {
121 struct task_with_ready_state {
122 task_with_ready_state(Func, G) { };
124 std::make_unique<task_with_ready_state>(std::move(func), __trans_tmp_1);
125 _promise->schedule(std::move(func));
127 template <typename Func, typename Param> void then(Func func, Param) {
130 schedule([ pr = std::move(pr), func, param = std::forward<Param> ]{});
134 template <typename Func> futurize_t<std::result_of_t<Func()>> then(Func) {
141 auto config = app.configuration()[0].as<std::string>();