Skip to content

Commit

Permalink
Test alignment of overaligned fields in One
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Oct 1, 2023
1 parent 6ed81d9 commit 8a602d4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/recordref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,3 +1336,20 @@ TEST_CASE("ScopedUpdate.RecordRef")
test(v);
test(v());
}

namespace
{
struct alignas(128) S128
{
int i;
};
} // namespace

using Overaligned = llama::Record<llama::Field<tag::B, int>, llama::Field<tag::A, S128>>;

TEST_CASE("RecordRef.alignment")
{
llama::One<Overaligned> record;
auto& s = record(tag::A{});
CHECK(reinterpret_cast<std::uintptr_t>(&s) % 128 == 0);
}

0 comments on commit 8a602d4

Please sign in to comment.