Commit 44e37ec5 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

A test verifying Function with max-align callables

Summary: [Folly] A test verifying `Function` behaves as expected with max-align callables.

Reviewed By: aary

Differential Revision: D14077496

fbshipit-source-id: 8a9efaee3cc4c5d69c6a94eb5ad1928d241eb4e0
parent f3eab11b
......@@ -1205,3 +1205,11 @@ TEST(Function, CtorWithCopy) {
TEST(Function, Bug_T23346238) {
const Function<void()> nullfun;
}
TEST(Function, MaxAlignCallable) {
using A = folly::aligned_storage_for_t<folly::max_align_t>;
auto f = [a = A()] { return reinterpret_cast<uintptr_t>(&a) % alignof(A); };
EXPECT_EQ(alignof(A), alignof(decltype(f))) << "sanity";
EXPECT_EQ(0, f()) << "sanity";
EXPECT_EQ(0, Function<size_t()>(f)());
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment