Final bit of P0063 - make sure that aligned_alloc is available when the underlying C library supports it

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338457 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2018-07-31 23:39:12 +00:00
parent 4983a7a649
commit ea96e3a707
3 changed files with 24 additions and 4 deletions

View File

@@ -13,6 +13,8 @@
#include <type_traits>
#include <cassert>
#include "test_macros.h"
// As of 1/10/2015 clang emits a -Wnonnull warnings even if the warning occurs
// in an unevaluated context. For this reason we manually suppress the warning.
#if defined(__clang__)
@@ -71,6 +73,14 @@ int main()
static_assert((std::is_same<decltype(std::strtoull("", endptr,0)), unsigned long long>::value), "");
static_assert((std::is_same<decltype(std::rand()), int>::value), "");
static_assert((std::is_same<decltype(std::srand(0)), void>::value), "");
// Microsoft does not implement aligned_alloc in their C library
#ifndef TEST_COMPILER_C1XX
#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
static_assert((std::is_same<decltype(std::aligned_alloc(0,0)), void*>::value), "");
#endif
#endif
static_assert((std::is_same<decltype(std::calloc(0,0)), void*>::value), "");
static_assert((std::is_same<decltype(std::free(0)), void>::value), "");
static_assert((std::is_same<decltype(std::malloc(0)), void*>::value), "");