1 // { dg-do compile }
2 // { dg-options "-std=gnu++11" }
3 
4 // Copyright (C) 2007-2016 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 // Tuple
22 
23 #include <tuple>
24 #include <testsuite_hooks.h>
25 
26 using namespace std;
27 
28 int
main()29 main()
30 {
31   bool test __attribute__((unused)) = true;
32 
33   static_assert(tuple_size<tuple<>>::value == 0, "");
34   static_assert(tuple_size<tuple<int>>::value == 1, "");
35   static_assert(tuple_size<tuple<void>>::value == 1, "");
36   typedef tuple<int,const int&,void> test_tuple1;
37   static_assert(tuple_size<test_tuple1>::value == 3, "");
38   static_assert(tuple_size<tuple<tuple<void>>>::value == 1, "");
39 
40   static_assert(tuple_size<const tuple<>>::value == 0, "");
41   static_assert(tuple_size<const tuple<int>>::value == 1, "");
42   static_assert(tuple_size<const tuple<void>>::value == 1, "");
43   static_assert(tuple_size<const test_tuple1>::value == 3, "");
44   static_assert(tuple_size<const tuple<tuple<void>>>::value == 1, "");
45 
46   static_assert(tuple_size<volatile tuple<>>::value == 0, "");
47   static_assert(tuple_size<volatile tuple<int>>::value == 1, "");
48   static_assert(tuple_size<volatile tuple<void>>::value == 1, "");
49   static_assert(tuple_size<volatile test_tuple1>::value == 3, "");
50   static_assert(tuple_size<volatile tuple<tuple<void>>>::value == 1, "");
51 
52   static_assert(tuple_size<const volatile tuple<>>::value == 0, "");
53   static_assert(tuple_size<const volatile tuple<int>>::value == 1, "");
54   static_assert(tuple_size<const volatile tuple<void>>::value == 1, "");
55   static_assert(tuple_size<const volatile test_tuple1>::value == 3, "");
56   static_assert(tuple_size<const volatile tuple<tuple<void>>>::value == 1,"");
57 }
58