diff options
author | Milad Fa <46688537+miladfarca@users.noreply.github.com> | 2021-10-26 10:09:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 10:09:11 -0400 |
commit | f70eadadd7767c3a97774b63c4c23981fa89af9f (patch) | |
tree | d2099f3a2d58ef22bbe6bc0780716cacacd5bca2 | |
parent | 46d939a918092ef94498a126dc1244b437100b31 (diff) |
Fix over-aligned layout test with older gcc compilers (#1049)
-rw-r--r-- | absl/container/internal/layout_test.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/absl/container/internal/layout_test.cc b/absl/container/internal/layout_test.cc index 1d7158ff..54e5d5bb 100644 --- a/absl/container/internal/layout_test.cc +++ b/absl/container/internal/layout_test.cc @@ -1350,7 +1350,13 @@ TEST(Layout, CustomAlignment) { TEST(Layout, OverAligned) { constexpr size_t M = alignof(max_align_t); constexpr Layout<unsigned char, Aligned<unsigned char, 2 * M>> x(1, 3); +#ifdef __GNUC__ + // Using __attribute__ ((aligned ())) instead of alignas to bypass a gcc bug: + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89357 + __attribute__((aligned(2 * M))) unsigned char p[x.AllocSize()]; +#else alignas(2 * M) unsigned char p[x.AllocSize()]; +#endif EXPECT_EQ(2 * M + 3, x.AllocSize()); EXPECT_THAT(x.Pointers(p), Tuple(p + 0, p + 2 * M)); } |