]>
Commit | Line | Data |
---|---|---|
de0830e1 | 1 | // { dg-do compile } |
4415f7a5 | 2 | // { dg-options "-std=gnu++11" } |
71743a68 | 3 | // |
818ab71a | 4 | // Copyright (C) 2011-2016 Free Software Foundation, Inc. |
bfef3a71 BK |
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. | |
71743a68 | 11 | // |
bfef3a71 BK |
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. | |
71743a68 | 16 | // |
bfef3a71 BK |
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 | ||
1b24fb4c JW |
21 | // NB: Don't include any other headers in this file. |
22 | // LWG 2212 requires <array> to define tuple_size<cv T> specializations. | |
bfef3a71 | 23 | #include <array> |
71743a68 PC |
24 | |
25 | void | |
26 | test01() | |
27 | { | |
28 | bool test __attribute__((unused)) = true; | |
1b24fb4c JW |
29 | using std::array; |
30 | using std::tuple_size; | |
31 | // This relies on the fact that <utility> includes <type_traits>: | |
32 | using std::is_same; | |
71743a68 PC |
33 | |
34 | { | |
35 | const size_t len = 5; | |
36 | typedef array<int, len> array_type; | |
de0830e1 VV |
37 | static_assert(tuple_size<array_type>::value == 5, ""); |
38 | static_assert(tuple_size<const array_type>::value == 5, ""); | |
39 | static_assert(tuple_size<volatile array_type>::value == 5, ""); | |
40 | static_assert(tuple_size<const volatile array_type>::value == 5, ""); | |
71743a68 PC |
41 | } |
42 | ||
43 | { | |
44 | const size_t len = 0; | |
45 | typedef array<float, len> array_type; | |
de0830e1 VV |
46 | static_assert(tuple_size<array_type>::value == 0, ""); |
47 | static_assert(tuple_size<const array_type>::value == 0, ""); | |
48 | static_assert(tuple_size<volatile array_type>::value == 0, ""); | |
49 | static_assert(tuple_size<const volatile array_type>::value == 0, ""); | |
71743a68 PC |
50 | } |
51 | } | |
bfef3a71 BK |
52 | |
53 | int main() | |
54 | { | |
71743a68 | 55 | test01(); |
bfef3a71 BK |
56 | return 0; |
57 | } |