File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -64,5 +64,21 @@ TEST(LlvmLibcMemAlignmentTest, SpecificAlignment) {
6464 uintptr_t addr_complex = 0x1234560 ; // 16-byte aligned (ends in 0)
6565 void *ptr_complex = reinterpret_cast <void *>(addr_complex);
6666 EXPECT_EQ (LIBC_NAMESPACE::memalignment (ptr_complex), static_cast <size_t >(16 ));
67- }
67+ }
68+
69+ TEST (LlvmLibcMemAlignmentTest, AlignasSpecifiedAlignment) {
70+ alignas (16 ) static int aligned_16;
71+ alignas (32 ) static int aligned_32;
72+ alignas (64 ) static int aligned_64;
73+ alignas (128 ) static int aligned_128;
74+ alignas (256 ) static int aligned_256;
75+
76+ EXPECT_GE (LIBC_NAMESPACE::memalignment (&aligned_16), static_cast <size_t >(16 ));
77+ EXPECT_GE (LIBC_NAMESPACE::memalignment (&aligned_32), static_cast <size_t >(32 ));
78+ EXPECT_GE (LIBC_NAMESPACE::memalignment (&aligned_64), static_cast <size_t >(64 ));
79+ EXPECT_GE (LIBC_NAMESPACE::memalignment (&aligned_128),
80+ static_cast <size_t >(128 ));
81+ EXPECT_GE (LIBC_NAMESPACE::memalignment (&aligned_256),
82+ static_cast <size_t >(256 ));
83+ }
6884
You can’t perform that action at this time.
0 commit comments