]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/experimental/iterator/requirements.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / experimental / iterator / requirements.cc
CommitLineData
f1717362 1// Copyright (C) 2015-2016 Free Software Foundation, Inc.
42fbc896 2//
3// This file is part of the GNU ISO C++ Library. This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
6// Free Software Foundation; either version 3, or (at your option)
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
17
18// { dg-options "-std=gnu++14" }
19// { dg-do compile }
20
21// This is a compile-only test with minimal includes
22#include <experimental/iterator>
23#include <iosfwd>
24
25using namespace std::experimental;
26
27template<typename Delim, typename Char>
28struct tester
29{
30 using joiner_type = ostream_joiner<Delim, Char>;
31 using ostream_type = std::basic_ostream<Char>;
32 using test_type = decltype(make_ostream_joiner(std::declval<ostream_type&>(),
33 std::declval<Delim>()));
34
35 static_assert(is_same_v<test_type, joiner_type>, "");
36
37 static_assert(is_same_v<typename test_type::char_type, Char>, "");
38
39 static_assert(is_same_v<typename test_type::traits_type,
40 std::char_traits<Char>>, "");
41
42 static_assert(is_same_v<typename test_type::ostream_type, ostream_type>, "");
43
44 static_assert(is_same_v<typename test_type::iterator_category,
45 std::output_iterator_tag>, "");
46
47 static_assert(is_same_v<typename test_type::value_type, void>, "");
48 static_assert(is_same_v<typename test_type::difference_type, void>, "");
49 static_assert(is_same_v<typename test_type::pointer, void>, "");
50 static_assert(is_same_v<typename test_type::reference, void>, "");
51};
52
53tester<char, char> cc;
54tester<int, char> ic;
55#if _GLIBCXX_USE_WCHAR_T
56tester<wchar_t, wchar_t> ww;
57tester<int, wchar_t> iw;
58#endif