]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/libstdc++-xmethods/array.cc
ff0339d3dd2e454b2be4e0e22296d5a74c94ab1d
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / libstdc++-xmethods / array.cc
1 // { dg-do run { target c++11 } }
2 // { dg-options "-g -O0" }
3
4 // Copyright (C) 2014-2024 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
20
21 #include <array>
22
23 int
24 main ()
25 {
26 std::array<int, 10> a;
27 std::array<int, 0> a1;
28
29 for (int i = 0; i < 10; i++)
30 a[i] = 100 + i;
31
32 // { dg-final { note-test a.size() 10 } }
33 // { dg-final { note-test a.empty() false } }
34 // { dg-final { note-test a1.empty() true } }
35 // { dg-final { note-test a1.size() 0 } }
36 // { dg-final { note-test a.front() 100 } }
37 // { dg-final { note-test a.back() 109 } }
38 // { dg-final { note-test a.at(5) 105 } }
39 // { dg-final { note-test a\[0\] 100 } }
40 // { dg-final { note-test a\[4\] 104 } }
41 // { dg-final { note-test a\[9\] 109 } }
42
43 // { dg-final { whatis-test a.size() std::size_t } }
44 // { dg-final { whatis-test a.empty() bool } }
45 // { dg-final { whatis-test a.front() int } }
46 // { dg-final { whatis-test a.back() int } }
47 // { dg-final { whatis-test a.at(5) int } }
48 // { dg-final { whatis-test a\[0\] int } }
49
50 return 0; // Mark SPOT
51 }
52
53 // { dg-final { gdb-test SPOT {} 1 } }