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 2, 2023
1 parent 499f4d0 commit 8f7f517
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/recordref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,3 +1336,23 @@ TEST_CASE("ScopedUpdate.RecordRef")
test(v);
test(v());
}

#ifndef _MSC_VER
// MSVC errors with: View.hpp: error C2719: 'blobs': formal parameter with requested alignment of 128 won't be aligned
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);
}
#endif

0 comments on commit 8f7f517

Please sign in to comment.