Skip to content

Commit f70eada

Browse files
authored
Fix over-aligned layout test with older gcc compilers (abseil#1049)
1 parent 46d939a commit f70eada

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

absl/container/internal/layout_test.cc

+6
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,13 @@ TEST(Layout, CustomAlignment) {
13501350
TEST(Layout, OverAligned) {
13511351
constexpr size_t M = alignof(max_align_t);
13521352
constexpr Layout<unsigned char, Aligned<unsigned char, 2 * M>> x(1, 3);
1353+
#ifdef __GNUC__
1354+
// Using __attribute__ ((aligned ())) instead of alignas to bypass a gcc bug:
1355+
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89357
1356+
__attribute__((aligned(2 * M))) unsigned char p[x.AllocSize()];
1357+
#else
13531358
alignas(2 * M) unsigned char p[x.AllocSize()];
1359+
#endif
13541360
EXPECT_EQ(2 * M + 3, x.AllocSize());
13551361
EXPECT_THAT(x.Pointers(p), Tuple(p + 0, p + 2 * M));
13561362
}

0 commit comments

Comments
 (0)