]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc
2 // { dg-options "-std=gnu++0x" }
4 // Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
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)
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.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
22 #include <type_traits>
26 struct int_result_type
{ typedef int result_type
; };
28 struct derives_unary
: std::unary_function
<int, int> {};
30 struct derives_binary
: std::binary_function
<int, float, int> {};
32 struct derives_unary_binary
33 : std::unary_function
<int, int>,
34 std::binary_function
<int, float, int>
36 typedef int result_type
;
41 using std::reference_wrapper
;
44 // Check result_type typedef
45 static_assert( is_same
<reference_wrapper
<int_result_type
>::result_type
, int>::value
, "has result_type" );
46 static_assert( is_same
<reference_wrapper
<derives_unary
>::result_type
, int>::value
, "has result_type" );
47 static_assert( is_same
<reference_wrapper
<derives_binary
>::result_type
, int>::value
, "has result_type" );
48 static_assert( is_same
<reference_wrapper
<derives_unary_binary
>::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(*)(void)>::result_type
, int>::value
, "has result_type" );
51 static_assert( is_same
<reference_wrapper
<int (::X::*)()>::result_type
, int>::value
, "has result_type" );
52 static_assert( is_same
<reference_wrapper
<int (::X::*)(float)>::result_type
, int>::value
, "has result_type" );