118334Speter// Copyright (C) 2014-2015 Free Software Foundation, Inc.
290075Sobrien//
3169689Skan// This file is part of the GNU ISO C++ Library.  This library is free
4169689Skan// software; you can redistribute it and/or modify it under the
518334Speter// terms of the GNU General Public License as published by the
690075Sobrien// Free Software Foundation; either version 3, or (at your option)
718334Speter// any later version.
890075Sobrien
990075Sobrien// This library is distributed in the hope that it will be useful,
1090075Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of
1190075Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1218334Speter// GNU General Public License for more details.
1390075Sobrien
1490075Sobrien// You should have received a copy of the GNU General Public License along
1590075Sobrien// with this library; see the file COPYING3.  If not see
1690075Sobrien// <http://www.gnu.org/licenses/>.
1718334Speter
1818334Speter// { dg-options "-std=gnu++14" }
1990075Sobrien
20169689Skan#include <experimental/tuple>
21169689Skan#include <testsuite_hooks.h>
2218334Speter
23169689Skanvoid
24169689Skantest01()
25169689Skan{
26169689Skan  auto t = std::make_tuple(1, '2', 3.0);
27169689Skan  std::experimental::apply( [&](int& i, char& c, double& d) {
28169689Skan      VERIFY(&i == &std::get<int>(t));
29169689Skan      VERIFY(&c == &std::get<char>(t));
30169689Skan      VERIFY(&d == &std::get<double>(t));
31169689Skan    }, t);
32169689Skan}
33169689Skan
34169689Skanconstexpr int func(int i, int j) { return i + j; }
35169689Skan
36169689Skanvoid
37169689Skantest02()
3818334Speter{
3918334Speter  constexpr auto t = std::make_tuple(1, 2);
4018334Speter  constexpr int i = std::experimental::apply(func, t);
4118334Speter  VERIFY( i == 3 );
4218334Speter}
4318334Speter
44117395Skanint
45169689Skanmain()
4618334Speter{
4718334Speter  test01();
4818334Speter  test02();
4950397Sobrien}
50117395Skan