//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // test #include #include #include #include "test_macros.h" #ifndef EXIT_FAILURE #error EXIT_FAILURE not defined #endif #ifndef EXIT_SUCCESS #error EXIT_SUCCESS not defined #endif #ifndef MB_CUR_MAX #error MB_CUR_MAX not defined #endif #ifndef NULL #error NULL not defined #endif #ifndef RAND_MAX #error RAND_MAX not defined #endif template void test_div_struct() { TestType obj; static_assert(sizeof(obj) >= sizeof(IntType) * 2, ""); // >= to account for alignment. static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); ((void) obj); }; template ()))> std::true_type has_abs_imp(int); template std::false_type has_abs_imp(...); template struct has_abs : decltype(has_abs_imp(0)) {}; void test_abs() { TEST_DIAGNOSTIC_PUSH TEST_CLANG_DIAGNOSTIC_IGNORED("-Wabsolute-value") static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert( (std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert(!has_abs::value, ""); static_assert(!has_abs::value, ""); static_assert(!has_abs::value, ""); static_assert(!has_abs::value, ""); TEST_DIAGNOSTIC_POP assert(std::abs(-1.) == 1); } int main(int, char**) { std::size_t s = 0; ((void)s); static_assert((std::is_same::value), ""); test_div_struct(); test_div_struct(); test_div_struct(); char** endptr = 0; static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); // std::aligned_alloc tested in cstdlib.aligned_alloc.compile.pass.cpp void* pv = 0; void (*handler)() = 0; int (*comp)(void const*, void const*) = 0; static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); #ifndef TEST_HAS_NO_WIDE_CHARACTERS wchar_t* pw = 0; const wchar_t* pwc = 0; char* pc = 0; static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); #endif test_abs(); return 0; }