1fc6cc700SMarshall Clow //===----------------------------------------------------------------------===// 2fc6cc700SMarshall Clow // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6fc6cc700SMarshall Clow // 7fc6cc700SMarshall Clow //===----------------------------------------------------------------------===// 8fc6cc700SMarshall Clow 9fc6cc700SMarshall Clow // <array> 10fc6cc700SMarshall Clow 11fc6cc700SMarshall Clow // class array 12fc6cc700SMarshall Clow 13*77b9abfcSLouis Dionne // constexpr bool empty() const noexcept; 14fc6cc700SMarshall Clow 15fc6cc700SMarshall Clow #include <array> 16fc6cc700SMarshall Clow #include <cassert> 17fc6cc700SMarshall Clow 18fc6cc700SMarshall Clow #include "test_macros.h" 19fc6cc700SMarshall Clow tests()20*77b9abfcSLouis DionneTEST_CONSTEXPR_CXX14 bool tests() 21fc6cc700SMarshall Clow { 22fc6cc700SMarshall Clow { 23fc6cc700SMarshall Clow typedef std::array<int, 2> C; 24*77b9abfcSLouis Dionne C c = {}; 25fc6cc700SMarshall Clow ASSERT_NOEXCEPT(c.empty()); 26fc6cc700SMarshall Clow assert(!c.empty()); 27fc6cc700SMarshall Clow } 28fc6cc700SMarshall Clow { 29fc6cc700SMarshall Clow typedef std::array<int, 0> C; 30*77b9abfcSLouis Dionne C c = {}; 31fc6cc700SMarshall Clow ASSERT_NOEXCEPT(c.empty()); 32fc6cc700SMarshall Clow assert(c.empty()); 33fc6cc700SMarshall Clow } 342df59c50SJF Bastien 35*77b9abfcSLouis Dionne return true; 36*77b9abfcSLouis Dionne } 37*77b9abfcSLouis Dionne main(int,char **)38*77b9abfcSLouis Dionneint main(int, char**) 39*77b9abfcSLouis Dionne { 40*77b9abfcSLouis Dionne tests(); 41*77b9abfcSLouis Dionne #if TEST_STD_VER >= 14 42*77b9abfcSLouis Dionne static_assert(tests(), ""); 43*77b9abfcSLouis Dionne #endif 44*77b9abfcSLouis Dionne 45*77b9abfcSLouis Dionne #if TEST_STD_VER >= 11 46*77b9abfcSLouis Dionne // Sanity check for constexpr in C++11 47*77b9abfcSLouis Dionne { 48*77b9abfcSLouis Dionne constexpr std::array<int, 3> array = {}; 49*77b9abfcSLouis Dionne static_assert(!array.empty(), ""); 50*77b9abfcSLouis Dionne } 51*77b9abfcSLouis Dionne #endif 52*77b9abfcSLouis Dionne 532df59c50SJF Bastien return 0; 54fc6cc700SMarshall Clow } 55