]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/in_place/requirements.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / in_place / requirements.cc
CommitLineData
1a669380 1// { dg-options "-std=gnu++17" }
2// { dg-do compile }
3
fbd26352 4// Copyright (C) 2016-2019 Free Software Foundation, Inc.
1a669380 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
a9aab74c 17// You should have received a copy of the GNU General Public License along
1a669380 18// with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
20
21#include <utility>
22#include <type_traits>
23#include <testsuite_hooks.h>
24
25using std::in_place_t;
26using std::in_place_type_t;
27using std::in_place_index_t;
28
29float f(in_place_type_t<float>);
30double f(in_place_type_t<double>);
31char f(in_place_index_t<0>);
32unsigned int f(in_place_index_t<1>);
33int f(in_place_t);
34
ee6c971a 35static_assert(std::is_same<decltype(f(std::in_place)), int>::value);
36static_assert(std::is_same<decltype(f(std::in_place_type<float>)),
37 float>::value);
38static_assert(std::is_same<decltype(f(std::in_place_type<double>)),
39 double>::value);
40static_assert(std::is_same<decltype(f(std::in_place_index<0>)), char>::value);
41static_assert(std::is_same<decltype(f(std::in_place_index<1>)),
42 unsigned int>::value);
1a669380 43
44template <class T, class... Args> float h(in_place_type_t<T>, Args&&...);
45template <size_t N, class... Args> int h(in_place_index_t<N>, Args&&...);
46template <class T> double h(in_place_t, T&&);
47
48static_assert(std::is_same<decltype(h(std::in_place, 1)), double>::value);
ee6c971a 49static_assert(std::is_same<decltype(h(std::in_place_type<float>, 1)),
50 float>::value);
51static_assert(std::is_same<decltype(h(std::in_place_index<0>, 1)),
52 int>::value);