2 // { dg-do run { target c++11 } }
6 template<typename Callable>
10 Bind_simple(const Callable& callable)
14 Bind_simple(const Bind_simple&) = default;
15 Bind_simple(Bind_simple&&) = default;
17 auto operator()() -> decltype((*(Callable*)0)())
19 return std::get<0>(_M_bound)();
24 std::tuple<Callable> _M_bound;
27 template<typename Callable>
29 bind_simple(Callable& callable)
31 return Bind_simple<Callable>(callable);
39 struct Impl : ImplBase {
41 Impl(T&& t) : t(std::move(t)) { }
47 auto p = make_routine(bind_simple(t));
54 template<typename Callable>
56 make_routine(Callable&& f)
58 return new Impl<Callable>(std::forward<Callable>(f));
64 class background_hello
69 __builtin_printf("default ctor called, this=%p\n", this);
73 background_hello(const background_hello &)
75 __builtin_printf("copy ctor called\n");
79 background_hello(background_hello &&)
81 __builtin_printf("move ctor called\n");
85 void operator ()() const
87 __builtin_printf("void background_hello::operator()() called, this=%p\n", this);
92 __builtin_printf("destructor called, this=%p\n", this);