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 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03
9 // UNSUPPORTED: windows
10 
11 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
12 // UNSUPPORTED: libcxx-no-debug-mode
13 
14 // test array<T, 0>::front() raises a debug error.
15 
16 #include <array>
17 #include "test_macros.h"
18 #include "debug_mode_helper.h"
19 
main(int,char **)20 int main(int, char**)
21 {
22   {
23     typedef std::array<int, 0> C;
24     C c = {};
25     C const& cc = c;
26     EXPECT_DEATH(c.front());
27     EXPECT_DEATH(cc.front());
28   }
29   {
30     typedef std::array<const int, 0> C;
31     C c = {{}};
32     C const& cc = c;
33     EXPECT_DEATH(c.front());
34     EXPECT_DEATH(cc.front());
35   }
36 
37   return 0;
38 }
39