]>
Commit | Line | Data |
---|---|---|
a7d0c94e BK |
1 | // { dg-do compile } |
2 | // { dg-options "-std=gnu++0x" } | |
3 | ||
4 | // Copyright (C) 2011 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 | ||
22 | // NOTE: This makes use of the fact that we know how moveable | |
23 | // is implemented on pair, and also vector. If the implementation | |
24 | // changes this test may begin to fail. | |
25 | ||
26 | #include <tuple> | |
27 | ||
28 | bool test __attribute__((unused)) = true; | |
29 | ||
30 | ||
31 | // make_tuple | |
a7d0c94e BK |
32 | void |
33 | test_make_tuple() | |
34 | { | |
35 | { | |
36 | typedef std::tuple<int, float> tuple_type; | |
71743a68 PC |
37 | constexpr tuple_type p1 __attribute__((unused)) |
38 | = std::make_tuple(22, 22.222); | |
a7d0c94e BK |
39 | } |
40 | ||
41 | { | |
42 | typedef std::tuple<int, float, int> tuple_type; | |
71743a68 PC |
43 | constexpr tuple_type p1 __attribute__((unused)) |
44 | = std::make_tuple(22, 22.222, 77799); | |
a7d0c94e BK |
45 | } |
46 | } | |
a7d0c94e BK |
47 | |
48 | // get | |
49 | void | |
50 | test_get() | |
51 | { | |
52 | { | |
53 | typedef std::tuple<int, float> tuple_type; | |
54 | constexpr tuple_type t1 { 55, 77.77 }; | |
71743a68 PC |
55 | constexpr auto var __attribute__((unused)) |
56 | = std::get<1>(t1); | |
a7d0c94e BK |
57 | } |
58 | ||
59 | { | |
60 | typedef std::tuple<int, float, int> tuple_type; | |
61 | constexpr tuple_type t1 { 55, 77.77, 99 }; | |
71743a68 PC |
62 | constexpr auto var __attribute__((unused)) |
63 | = std::get<2>(t1); | |
a7d0c94e BK |
64 | } |
65 | } | |
66 | ||
67 | // tuple_cat | |
68 | void | |
69 | test_tuple_cat() | |
70 | { | |
71 | typedef std::tuple<int, float> tuple_type1; | |
72 | typedef std::tuple<int, int, float> tuple_type2; | |
73 | ||
74 | constexpr tuple_type1 t1 { 55, 77.77 }; | |
75 | constexpr tuple_type2 t2 { 55, 99, 77.77 }; | |
71743a68 | 76 | constexpr auto cat1 __attribute__((unused)) = std::tuple_cat(t1, t2); |
a7d0c94e | 77 | } |
a7d0c94e BK |
78 | |
79 | int | |
80 | main() | |
81 | { | |
a7d0c94e | 82 | test_make_tuple(); |
a7d0c94e | 83 | test_get(); |
a7d0c94e BK |
84 | test_tuple_cat(); |
85 | ||
86 | return 0; | |
87 | } |