[SLP] Make getSameOpcode support different instructions if they have same semantics...
[llvm-project.git] / libcxx / test / std / containers / sequences / array / empty.pass.cpp
blob8b61575c2e731a573469f5b5d2a105a8be612df0
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <array>
11 // class array
13 // constexpr bool empty() const noexcept;
15 #include <array>
16 #include <cassert>
18 #include "test_macros.h"
20 TEST_CONSTEXPR_CXX14 bool tests()
23 typedef std::array<int, 2> C;
24 C c = {};
25 ASSERT_NOEXCEPT(c.empty());
26 assert(!c.empty());
29 typedef std::array<int, 0> C;
30 C c = {};
31 ASSERT_NOEXCEPT(c.empty());
32 assert(c.empty());
35 return true;
38 int main(int, char**)
40 tests();
41 #if TEST_STD_VER >= 14
42 static_assert(tests(), "");
43 #endif
45 #if TEST_STD_VER >= 11
46 // Sanity check for constexpr in C++11
48 constexpr std::array<int, 3> array = {};
49 static_assert(!array.empty(), "");
51 #endif
53 return 0;