1 // { dg-do compile { target c++20 } }
12 // PR libstdc++/107784 - QOI: sizeof( bind_front( Member-Function ) ) too big
13 static_assert( sizeof(std::bind_front(&Foo::func
)) == sizeof(&Foo::func
) );
14 static_assert( sizeof(std::bind_front(&bar
)) == sizeof(&bar
) );
16 // PR libstdc++/108290 - QoI: bind_front captureless lambda is too big
17 auto empty_lambda
= [](auto, auto) { return 0; };
20 void operator()(int, int, int) { }
21 template<typename T
> void operator()(T
, T
) { }
24 static_assert(sizeof(std::bind_front(empty_lambda
)) == 1);
25 static_assert(sizeof(std::bind_front(empty_lambda
, 1)) == sizeof(int));
26 static_assert(sizeof(std::bind_front(empty_lambda
, empty_lambda
)) == 2);
27 static_assert(sizeof(std::bind_front(empty_lambda
, empty_class
)) == 1);
28 static_assert(sizeof(std::bind_front(empty_lambda
, 1, 2)) == 2 * sizeof(int));
29 static_assert(sizeof(std::bind_front(empty_lambda
, '1', empty_lambda
)) == 2);
30 static_assert(sizeof(std::bind_front(empty_lambda
, '1', empty_class
)) == 1);
32 static_assert(sizeof(std::bind_front(empty_class
)) == 1);
33 static_assert(sizeof(std::bind_front(empty_class
, 1)) == sizeof(int));
34 static_assert(sizeof(std::bind_front(empty_class
, empty_lambda
)) == 1);
35 static_assert(sizeof(std::bind_front(empty_class
, empty_class
)) == 2);
36 static_assert(sizeof(std::bind_front(empty_class
, 1, 2)) == 2 * sizeof(int));
37 static_assert(sizeof(std::bind_front(empty_class
, '1', empty_lambda
)) == 1);
38 static_assert(sizeof(std::bind_front(empty_class
, '1', empty_class
)) == 2);
40 struct derived1
: decltype(std::bind_front(empty_class
))
44 static_assert(sizeof(derived1
) == sizeof(int));
46 struct derived2
: decltype(std::bind_front(empty_class
, empty_lambda
))
50 static_assert(sizeof(derived2
) == sizeof(int));