[libcxx] r348485 - [libcxx] Make return value of array<T, 0>.data() checked only for libc++
Louis Dionne
ldionne at apple.com
Thu Dec 6 05:52:20 PST 2018
Author: ldionne
Date: Thu Dec 6 05:52:20 2018
New Revision: 348485
URL: http://llvm.org/viewvc/llvm-project?rev=348485&view=rev
Log:
[libcxx] Make return value of array<T, 0>.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<T, 0>.data() return value as
libc++ specific.
Reviewed as https://reviews.llvm.org/D55364.
Thanks to Andrey Maksimov for the patch.
Modified:
libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp
libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp
Modified: libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp?rev=348485&r1=348484&r2=348485&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp Thu Dec 6 05:52:20 2018
@@ -42,7 +42,7 @@ int main()
typedef std::array<T, 0> 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<decltype(c.data()), const T*>::value), "");
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
}
{
typedef std::max_align_t T;
typedef std::array<T, 0> C;
const C c = {};
const T* p = c.data();
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
std::uintptr_t pint = reinterpret_cast<std::uintptr_t>(p);
assert(pint % TEST_ALIGNOF(std::max_align_t) == 0);
}
@@ -66,6 +66,6 @@ int main()
typedef std::array<T, 0> C;
C c = {};
T* p = c.data();
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
}
}
Modified: libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp?rev=348485&r1=348484&r2=348485&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp Thu Dec 6 05:52:20 2018
@@ -48,14 +48,14 @@ int main()
typedef std::array<T, 0> 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<T, 0> C;
const C c = {};
const T* p = c.data();
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
std::uintptr_t pint = reinterpret_cast<std::uintptr_t>(p);
assert(pint % TEST_ALIGNOF(std::max_align_t) == 0);
}
More information about the libcxx-commits
mailing list