1 // { dg-options "-std=gnu++0x" }
3 // 2010-04-30 Paolo Carlini <paolo.carlini@oracle.com>
5 // Copyright (C) 2010 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
26 #include <testsuite_hooks.h>
30 type_zero() : n_(757) { }
32 type_zero(const type_zero
&) = delete;
33 type_zero(type_zero
&& other
) : n_(other
.n_
) { }
35 int get() const { return n_
; }
43 type_one(int n
) : n_(n
) { }
45 type_one(const type_one
&) = delete;
46 type_one(type_one
&& other
) : n_(other
.n_
) { }
48 int get() const { return n_
; }
56 type_two(int n1
, int n2
) : n1_(n1
), n2_(n2
) { }
58 type_two(const type_two
&) = delete;
59 type_two(type_two
&& other
) : n1_(other
.n1_
), n2_(other
.n2_
) { }
61 int get1() const { return n1_
; }
62 int get2() const { return n2_
; }
70 bool test
__attribute__((unused
)) = true;
72 std::pair
<type_one
, type_zero
> pp0(std::piecewise_construct_t(),
73 std::forward_as_tuple(-3),
74 std::forward_as_tuple());
75 VERIFY( pp0
.first
.get() == -3 );
76 VERIFY( pp0
.second
.get() == 757 );
78 std::pair
<type_one
, type_two
> pp1(std::piecewise_construct_t(),
79 std::forward_as_tuple(6),
80 std::forward_as_tuple(5, 4));
81 VERIFY( pp1
.first
.get() == 6 );
82 VERIFY( pp1
.second
.get1() == 5 );
83 VERIFY( pp1
.second
.get2() == 4 );
85 std::pair
<type_two
, type_two
> pp2(std::piecewise_construct_t(),
86 std::forward_as_tuple(2, 1),
87 std::forward_as_tuple(-1, -3));
88 VERIFY( pp2
.first
.get1() == 2 );
89 VERIFY( pp2
.first
.get2() == 1 );
90 VERIFY( pp2
.second
.get1() == -1 );
91 VERIFY( pp2
.second
.get2() == -3 );