]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / reference_wrapper / typedefs.cc
CommitLineData
52066eae 1// { dg-do compile { target c++11 } }
7a90b0ca 2
cbe34bb5 3// Copyright (C) 2008-2017 Free Software Foundation, Inc.
7a90b0ca
PC
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
748086b7 8// Free Software Foundation; either version 3, or (at your option)
7a90b0ca
PC
9// any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License along
748086b7
JJ
17// with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
7a90b0ca
PC
19
20#include <functional>
21#include <type_traits>
7a90b0ca
PC
22
23struct X {};
24
25struct int_result_type { typedef int result_type; };
26
27struct derives_unary : std::unary_function<int, int> {};
28
29struct derives_binary : std::binary_function<int, float, int> {};
30
31struct derives_unary_binary
32 : std::unary_function<int, int>,
33 std::binary_function<int, float, int>
34{
35 typedef int result_type;
36};
37
38void test01()
39{
7a90b0ca
PC
40 using std::reference_wrapper;
41 using std::is_same;
7a90b0ca
PC
42
43 // Check result_type typedef
be7f7822
JW
44 static_assert( is_same<reference_wrapper<int_result_type>::result_type, int>::value, "has result_type" );
45 static_assert( is_same<reference_wrapper<derives_unary>::result_type, int>::value, "has result_type" );
46 static_assert( is_same<reference_wrapper<derives_binary>::result_type, int>::value, "has result_type" );
47 static_assert( is_same<reference_wrapper<derives_unary_binary>::result_type, int>::value, "has result_type" );
48 static_assert( is_same<reference_wrapper<int(void)>::result_type, int>::value, "has result_type" );
49 static_assert( is_same<reference_wrapper<int(*)(void)>::result_type, int>::value, "has result_type" );
50 static_assert( is_same<reference_wrapper<int (::X::*)()>::result_type, int>::value, "has result_type" );
51 static_assert( is_same<reference_wrapper<int (::X::*)(float)>::result_type, int>::value, "has result_type" );
7a90b0ca
PC
52}
53
54int main()
55{
56 test01();
57 return 0;
58}