From edfdc498b8c3b60a548118051c8af96bcf97e731 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 6 Dec 2018 13:52:20 +0000 Subject: [PATCH] [libcxx] Make return value of array.data() checked only for libc++ The section array.zero says: "The return value of data() is unspecified". This patch marks all checks of the array.data() return value as libc++ specific. Reviewed as https://reviews.llvm.org/D55364. Thanks to Andrey Maksimov for the patch. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348485 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../containers/sequences/array/array.data/data.pass.cpp | 8 ++++---- .../sequences/array/array.data/data_const.pass.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/std/containers/sequences/array/array.data/data.pass.cpp b/test/std/containers/sequences/array/array.data/data.pass.cpp index 436cea431..ba2c571eb 100644 --- a/test/std/containers/sequences/array/array.data/data.pass.cpp +++ b/test/std/containers/sequences/array/array.data/data.pass.cpp @@ -42,7 +42,7 @@ int main() typedef std::array C; C c = {}; T* p = c.data(); - assert(p != nullptr); + LIBCPP_ASSERT(p != nullptr); } { typedef double T; @@ -50,14 +50,14 @@ int main() C c = {{}}; const T* p = c.data(); static_assert((std::is_same::value), ""); - assert(p != nullptr); + LIBCPP_ASSERT(p != nullptr); } { typedef std::max_align_t T; typedef std::array C; const C c = {}; const T* p = c.data(); - assert(p != nullptr); + LIBCPP_ASSERT(p != nullptr); std::uintptr_t pint = reinterpret_cast(p); assert(pint % TEST_ALIGNOF(std::max_align_t) == 0); } @@ -66,6 +66,6 @@ int main() typedef std::array C; C c = {}; T* p = c.data(); - assert(p != nullptr); + LIBCPP_ASSERT(p != nullptr); } } diff --git a/test/std/containers/sequences/array/array.data/data_const.pass.cpp b/test/std/containers/sequences/array/array.data/data_const.pass.cpp index 0b6c0c48d..f46352564 100644 --- a/test/std/containers/sequences/array/array.data/data_const.pass.cpp +++ b/test/std/containers/sequences/array/array.data/data_const.pass.cpp @@ -48,14 +48,14 @@ int main() typedef std::array C; const C c = {}; const T* p = c.data(); - assert(p != nullptr); + LIBCPP_ASSERT(p != nullptr); } { typedef std::max_align_t T; typedef std::array C; const C c = {}; const T* p = c.data(); - assert(p != nullptr); + LIBCPP_ASSERT(p != nullptr); std::uintptr_t pint = reinterpret_cast(p); assert(pint % TEST_ALIGNOF(std::max_align_t) == 0); }