//===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // type_traits // is_array #include #include // for std::nullptr_t #include "test_macros.h" template void test_is_array() { static_assert( std::is_array::value, ""); static_assert( std::is_array::value, ""); static_assert( std::is_array::value, ""); static_assert( std::is_array::value, ""); #if TEST_STD_VER > 14 static_assert( std::is_array_v, ""); static_assert( std::is_array_v, ""); static_assert( std::is_array_v, ""); static_assert( std::is_array_v, ""); #endif } template void test_is_not_array() { static_assert(!std::is_array::value, ""); static_assert(!std::is_array::value, ""); static_assert(!std::is_array::value, ""); static_assert(!std::is_array::value, ""); #if TEST_STD_VER > 14 static_assert(!std::is_array_v, ""); static_assert(!std::is_array_v, ""); static_assert(!std::is_array_v, ""); static_assert(!std::is_array_v, ""); #endif } class Empty { }; class NotEmpty { virtual ~NotEmpty(); }; union Union {}; struct bit_zero { int : 0; }; class Abstract { virtual ~Abstract() = 0; }; enum Enum {zero, one}; struct incomplete_type; typedef void (*FunctionPtr)(); int main(int, char**) { test_is_array(); // Android clang-r536225 identifies as clang-19.0, but it predates the // LLVM 19.0.0 release. It lacks llvm.org/pr86652, which changed __is_array // to return false for T[0]. llvm.org/pr93037 relies on that change for // correct handling of std::is_array. This test will pass as long as // Clang and libc++ come from the same LLVM commit, but we can't detect that // here. #if !defined(__ANDROID__) || TEST_CLANG_VER != 1900 test_is_not_array(); #endif test_is_array(); test_is_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); test_is_not_array(); // LWG#2582 return 0; }