Fix over-aligned layout test with older gcc compilers (#1049)

pull/1050/head
Milad Fa 3 years ago committed by GitHub
parent 46d939a918
commit f70eadadd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      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));
}

Loading…
Cancel
Save