Fix compilation error with -Werror=array-bounds
This error happened only with O2 or O3 in my tests. Casting to uintptr_t and back seems to quiet the compiler.
This commit is contained in:
parent
1449ae042e
commit
114150e80c
|
@ -237,7 +237,8 @@ TEST(span, ContainsPtr)
|
|||
EXPECT_TRUE(a_span.contains_ptr(&a[0] + 1));
|
||||
EXPECT_TRUE(a_span.contains_ptr(&a[0] + 2));
|
||||
EXPECT_FALSE(a_span.contains_ptr(&a[0] + 3));
|
||||
EXPECT_FALSE(a_span.contains_ptr(&a[0] - 1));
|
||||
int *ptr_before = reinterpret_cast<int *>(reinterpret_cast<uintptr_t>(a.data()) - 1);
|
||||
EXPECT_FALSE(a_span.contains_ptr(ptr_before));
|
||||
EXPECT_FALSE(a_span.contains_ptr(&other));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue