1 From 0755fde6008ab7a7ae98f3b4c5967191408431f3 Mon Sep 17 00:00:00 2001
2 From: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
3 Date: Sat, 23 Apr 2011 17:51:31 +0000
4 Subject: [PATCH 173/200] 2011-04-23 Jonathan Wakely <jwakely.gcc@gmail.com>
7 * include/std/type_traits (result_of): Handle pointer to member.
8 * include/std/functional (__invoke): Likewise.
9 (_Function_to_function_pointer): Remove.
10 (_Reference_wrapper_base): Provide nested types independent of
11 unary_function and binary_function.
12 (reference_wrapper::operator()): DR 2017.
13 (ref(const A&&), cref(const A&&): Define as deleted.
14 * include/std/future (async): Simplify SFINAE and use result_of to
15 support pointer to member.
16 * testsuite/20_util/reference_wrapper/invoke.cc: Test pointer to
18 * testsuite/20_util/reference_wrapper/24803.cc: Likewise.
19 * testsuite/20_util/reference_wrapper/typedefs.cc: Test for types
20 instead of derivation from unary_function and binary_function.
21 * testsuite/20_util/reference_wrapper/invoke-2.cc: New.
22 * testsuite/20_util/reference_wrapper/ref_neg.c: New.
23 * testsuite/20_util/reference_wrapper/typedefs-3.c: New.
27 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172901 138bc75d-0d04-0410-961f-82ee72b054a4
29 index 660e371..57ec506 100644
30 --- a/libstdc++-v3/include/std/functional
31 +++ b/libstdc++-v3/include/std/functional
32 @@ -212,19 +212,6 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
33 static const bool value = sizeof(__test((_Tp*)0)) == 1;
36 - /// Turns a function type into a function pointer type
37 - template<typename _Tp, bool _IsFunctionType = is_function<_Tp>::value>
38 - struct _Function_to_function_pointer
43 - template<typename _Tp>
44 - struct _Function_to_function_pointer<_Tp, true>
50 * Invoke a function object, which may be either a member pointer or a
51 * function object. The first parameter will tell which.
52 @@ -235,20 +222,33 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
53 (!is_member_pointer<_Functor>::value
54 && !is_function<_Functor>::value
55 && !is_function<typename remove_pointer<_Functor>::type>::value),
56 - typename result_of<_Functor(_Args...)>::type
57 + typename result_of<_Functor(_Args&&...)>::type
59 __invoke(_Functor& __f, _Args&&... __args)
61 return __f(std::forward<_Args>(__args)...);
64 + template<typename _Functor, typename... _Args>
67 + (is_member_pointer<_Functor>::value
68 + && !is_function<_Functor>::value
69 + && !is_function<typename remove_pointer<_Functor>::type>::value),
70 + typename result_of<_Functor(_Args&&...)>::type
72 + __invoke(_Functor& __f, _Args&&... __args)
74 + return mem_fn(__f)(std::forward<_Args>(__args)...);
77 // To pick up function references (that will become function pointers)
78 template<typename _Functor, typename... _Args>
81 (is_pointer<_Functor>::value
82 && is_function<typename remove_pointer<_Functor>::type>::value),
83 - typename result_of<_Functor(_Args...)>::type
84 + typename result_of<_Functor(_Args&&...)>::type
86 __invoke(_Functor __f, _Args&&... __args)
88 @@ -263,40 +263,43 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
89 template<bool _Unary, bool _Binary, typename _Tp>
90 struct _Reference_wrapper_base_impl;
92 - // Not a unary_function or binary_function, so try a weak result type.
93 + // None of the nested argument types.
94 template<typename _Tp>
95 struct _Reference_wrapper_base_impl<false, false, _Tp>
96 : _Weak_result_type<_Tp>
99 - // unary_function but not binary_function
100 + // Nested argument_type only.
101 template<typename _Tp>
102 struct _Reference_wrapper_base_impl<true, false, _Tp>
103 - : unary_function<typename _Tp::argument_type,
104 - typename _Tp::result_type>
106 + : _Weak_result_type<_Tp>
108 + typedef typename _Tp::argument_type argument_type;
111 - // binary_function but not unary_function
112 + // Nested first_argument_type and second_argument_type only.
113 template<typename _Tp>
114 struct _Reference_wrapper_base_impl<false, true, _Tp>
115 - : binary_function<typename _Tp::first_argument_type,
116 - typename _Tp::second_argument_type,
117 - typename _Tp::result_type>
119 + : _Weak_result_type<_Tp>
121 + typedef typename _Tp::first_argument_type first_argument_type;
122 + typedef typename _Tp::second_argument_type second_argument_type;
125 - // Both unary_function and binary_function. Import result_type to
126 - // avoid conflicts.
127 + // All the nested argument types.
128 template<typename _Tp>
129 struct _Reference_wrapper_base_impl<true, true, _Tp>
130 - : unary_function<typename _Tp::argument_type,
131 - typename _Tp::result_type>,
132 - binary_function<typename _Tp::first_argument_type,
133 - typename _Tp::second_argument_type,
134 - typename _Tp::result_type>
135 + : _Weak_result_type<_Tp>
137 - typedef typename _Tp::result_type result_type;
138 + typedef typename _Tp::argument_type argument_type;
139 + typedef typename _Tp::first_argument_type first_argument_type;
140 + typedef typename _Tp::second_argument_type second_argument_type;
143 + _GLIBCXX_HAS_NESTED_TYPE(argument_type)
144 + _GLIBCXX_HAS_NESTED_TYPE(first_argument_type)
145 + _GLIBCXX_HAS_NESTED_TYPE(second_argument_type)
148 * Derives from unary_function or binary_function when it
149 * can. Specializations handle all of the easy cases. The primary
150 @@ -306,8 +309,9 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
151 template<typename _Tp>
152 struct _Reference_wrapper_base
153 : _Reference_wrapper_base_impl<
154 - _Derives_from_unary_function<_Tp>::value,
155 - _Derives_from_binary_function<_Tp>::value,
156 + __has_argument_type<_Tp>::value,
157 + __has_first_argument_type<_Tp>::value
158 + && __has_second_argument_type<_Tp>::value,
162 @@ -422,12 +426,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
163 class reference_wrapper
164 : public _Reference_wrapper_base<typename remove_cv<_Tp>::type>
166 - // If _Tp is a function type, we can't form result_of<_Tp(...)>,
167 - // so turn it into a function pointer type.
168 - typedef typename _Function_to_function_pointer<_Tp>::type
176 @@ -456,7 +456,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
179 template<typename... _Args>
180 - typename result_of<_M_func_type(_Args...)>::type
181 + typename result_of<_Tp&(_Args&&...)>::type
182 operator()(_Args&&... __args) const
184 return __invoke(get(), std::forward<_Args>(__args)...);
185 @@ -476,6 +476,12 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
187 { return reference_wrapper<const _Tp>(__t); }
189 + template<typename _Tp>
190 + void ref(const _Tp&&) = delete;
192 + template<typename _Tp>
193 + void cref(const _Tp&&) = delete;
195 /// Partial specialization.
196 template<typename _Tp>
197 inline reference_wrapper<_Tp>
198 diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
199 index 17d46db..970ce76 100644
200 --- a/libstdc++-v3/include/std/future
201 +++ b/libstdc++-v3/include/std/future
202 @@ -142,11 +142,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
203 future<typename result_of<_Fn(_Args...)>::type>
204 async(launch __policy, _Fn&& __fn, _Args&&... __args);
206 + template<typename _FnCheck, typename _Fn, typename... _Args>
207 + struct __async_sfinae_helper
209 + typedef future<typename result_of<_Fn(_Args...)>::type> type;
212 + template<typename _Fn, typename... _Args>
213 + struct __async_sfinae_helper<launch, _Fn, _Args...>
216 template<typename _Fn, typename... _Args>
218 - enable_if<!is_same<typename decay<_Fn>::type, launch>::value,
219 - future<decltype(std::declval<_Fn>()(std::declval<_Args>()...))>
221 + __async_sfinae_helper<typename decay<_Fn>::type, _Fn, _Args...>::type
222 async(_Fn&& __fn, _Args&&... __args);
224 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
225 @@ -1366,9 +1374,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
226 /// async, potential overload
227 template<typename _Fn, typename... _Args>
229 - enable_if<!is_same<typename decay<_Fn>::type, launch>::value,
230 - future<decltype(std::declval<_Fn>()(std::declval<_Args>()...))>
232 + __async_sfinae_helper<typename decay<_Fn>::type, _Fn, _Args...>::type
233 async(_Fn&& __fn, _Args&&... __args)
235 return async(launch::any, std::forward<_Fn>(__fn),
236 diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
237 index f5d867b..2361152 100644
238 --- a/libstdc++-v3/include/std/type_traits
239 +++ b/libstdc++-v3/include/std/type_traits
240 @@ -1140,12 +1140,92 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
241 template<typename _Signature>
244 + template<typename _MemPtr, typename _Arg>
245 + struct _Result_of_memobj;
247 + template<typename _Res, typename _Class, typename _Arg>
248 + struct _Result_of_memobj<_Res _Class::*, _Arg>
251 + typedef _Res _Class::* _Func;
253 + template<typename _Tp>
254 + static _Tp _S_get(const _Class&);
255 + template<typename _Tp>
256 + static decltype(*std::declval<_Tp>()) _S_get(...);
260 + decltype(_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>())
264 + template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
265 + struct _Result_of_memfun;
267 + template<typename _Res, typename _Class, typename _Arg, typename... _Args>
268 + struct _Result_of_memfun<_Res _Class::*, _Arg, _Args...>
271 + typedef _Res _Class::* _Func;
273 + template<typename _Tp>
274 + static _Tp _S_get(const _Class&);
275 + template<typename _Tp>
276 + static decltype(*std::declval<_Tp>()) _S_get(...);
280 + decltype((_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>())
281 + (std::declval<_Args>()...) )
285 + template<bool, bool, typename _Functor, typename... _ArgTypes>
286 + struct _Result_of_impl;
288 template<typename _Functor, typename... _ArgTypes>
289 - struct result_of<_Functor(_ArgTypes...)>
290 + struct _Result_of_impl<false, false, _Functor, _ArgTypes...>
293 decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) )
298 + template<typename _MemPtr, typename _Arg>
299 + struct _Result_of_impl<true, false, _MemPtr, _Arg>
300 + : _Result_of_memobj<typename remove_reference<_MemPtr>::type, _Arg>
302 + typedef typename _Result_of_memobj<
303 + typename remove_reference<_MemPtr>::type, _Arg>::__type
307 + template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
308 + struct _Result_of_impl<false, true, _MemPtr, _Arg, _ArgTypes...>
309 + : _Result_of_memfun<typename remove_reference<_MemPtr>::type, _Arg,
312 + typedef typename _Result_of_memfun<
313 + typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...>::__type
317 + template<typename _Functor, typename... _ArgTypes>
318 + struct result_of<_Functor(_ArgTypes...)>
319 + : _Result_of_impl<is_member_object_pointer<
320 + typename remove_reference<_Functor>::type >::value,
321 + is_member_function_pointer<
322 + typename remove_reference<_Functor>::type >::value,
323 + _Functor, _ArgTypes...>
325 + typedef typename _Result_of_impl<
326 + is_member_object_pointer<
327 + typename remove_reference<_Functor>::type >::value,
328 + is_member_function_pointer<
329 + typename remove_reference<_Functor>::type >::value,
330 + _Functor, _ArgTypes...>::__type
335 diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc
336 index 598c5c8..4bf6148 100644
337 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc
338 +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc
340 // { dg-options "-std=gnu++0x" }
343 -// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
344 +// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
346 // This file is part of the GNU ISO C++ Library. This library is free
347 // software; you can redistribute it and/or modify it under the
348 @@ -46,12 +46,18 @@ void verify_return_type(T, T)
352 + test_type* null_tt = 0;
353 + const test_type* null_ttc = 0;
356 std::reference_wrapper<double (int)>* pr1(0);
357 verify_return_type((*pr1)(0), double());
358 std::reference_wrapper<double (*)(int)>* pr2(0);
359 verify_return_type((*pr2)(0), double());
360 + std::reference_wrapper<int (test_type::*)()>* pr3(0);
361 + verify_return_type((*pr3)(null_tt), int());
362 + std::reference_wrapper<int (test_type::*)()const>* pr4(0);
363 + verify_return_type((*pr4)(null_ttc), int());
364 std::reference_wrapper<functor1>* pr5(0);
367 @@ -62,6 +68,10 @@ void test01()
368 verify_return_type((*pr1b)(0, 0), double());
369 std::reference_wrapper<double (*)(int, char)>* pr2b(0);
370 verify_return_type((*pr2b)(0, 0), double());
371 + std::reference_wrapper<int (test_type::*)(char)>* pr3b(0);
372 + verify_return_type((*pr3b)(null_tt,zero), int());
373 + std::reference_wrapper<int (test_type::*)()const>* pr4b(0);
374 + verify_return_type((*pr4b)(null_ttc), int());
375 std::reference_wrapper<functor2>* pr5b(0);
378 diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc
380 index 0000000..bd9aeb2
382 +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc
384 +// { dg-options "-std=gnu++0x" }
386 +// Copyright (C) 2011 Free Software Foundation, Inc.
388 +// This file is part of the GNU ISO C++ Library. This library is free
389 +// software; you can redistribute it and/or modify it under the
390 +// terms of the GNU General Public License as published by the
391 +// Free Software Foundation; either version 2, or (at your option)
392 +// any later version.
394 +// This library is distributed in the hope that it will be useful,
395 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
396 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
397 +// GNU General Public License for more details.
399 +// You should have received a copy of the GNU General Public License along
400 +// with this library; see the file COPYING. If not, write to the Free
401 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
404 +// 20.6.4 function object return types [func.ret]
405 +#include <functional>
409 + int f(int) { return 0; }
415 + typedef int (X::*mfp)(int);
416 + typedef int X::*mp;
421 + std::ref(m)(&x, 1);
422 + int& i1 = std::ref(m2)(x);
423 + int& i2 = std::ref(m2)(&x);
431 diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc
432 index b371f1c..7b694c7 100644
433 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc
434 +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc
436 // { dg-options "-std=gnu++0x" }
438 -// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
439 +// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
441 // This file is part of the GNU ISO C++ Library. This library is free
442 // software; you can redistribute it and/or modify it under the
443 @@ -36,6 +36,7 @@ struct X
444 int foo_c(float x) const { return truncate_float(x); }
445 int foo_v(float x) volatile { return truncate_float(x); }
446 int foo_cv(float x) const volatile { return truncate_float(x); }
447 + int foo_varargs(float x, ...) { return truncate_float(x); }
449 int operator()(float x)
451 @@ -69,6 +70,13 @@ void test01()
453 ::get_seventeen get_sev;
456 + int (::X::* p_foo)(float) = &::X::foo;
457 + int (::X::* p_foo_c)(float) const = &::X::foo_c;
458 + int (::X::* p_foo_v)(float) volatile = &::X::foo_v;
459 + int (::X::* p_foo_cv)(float) const volatile = &::X::foo_cv;
460 + int (::X::* p_foo_varargs)(float, ...) = &::X::foo_varargs;
461 + int ::X::* p_bar = &::X::bar;
463 const float pi = 3.14;
465 @@ -77,8 +85,26 @@ void test01()
466 VERIFY(ref(seventeen)() == 17);
469 - VERIFY(cref(&truncate_float)(pi) == 3);
470 - VERIFY(cref(&seventeen)() == 17);
471 + VERIFY(cref(truncate_float)(pi) == 3);
472 + VERIFY(cref(seventeen)() == 17);
474 + // Member function pointers
475 + VERIFY(ref(p_foo)(x, pi) == 3);
476 + VERIFY(ref(p_foo)(xp, pi) == 3);
477 + VERIFY(ref(p_foo_c)(x, pi) == 3);
478 + VERIFY(ref(p_foo_c)(xp, pi) == 3);
479 + VERIFY(ref(p_foo_v)(x, pi) == 3);
480 + VERIFY(ref(p_foo_v)(xp, pi) == 3);
481 + VERIFY(ref(p_foo_cv)(x, pi) == 3);
482 + VERIFY(ref(p_foo_cv)(xp, pi) == 3);
483 + // VERIFY(ref(p_foo_varargs)(x, pi) == 3);
484 + // VERIFY(ref(p_foo_varargs)(xp, pi, 1, 1) == 3);
485 + // VERIFY(ref(p_foo_varargs)(x, pi, 1, 1) == 3);
486 + // VERIFY(ref(p_foo_varargs)(xp, pi) == 3);
488 + // Member data pointers
489 + VERIFY(ref(p_bar)(x) == 17);
490 + VERIFY(ref(p_bar)(xp) == 17);
493 VERIFY(ref(get_sev)() == 17);
494 diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/ref_neg.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/ref_neg.cc
496 index 0000000..947a9b0
498 +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/ref_neg.cc
500 +// Copyright (C) 2011 Free Software Foundation, Inc.
502 +// This file is part of the GNU ISO C++ Library. This library is free
503 +// software; you can redistribute it and/or modify it under the
504 +// terms of the GNU General Public License as published by the
505 +// Free Software Foundation; either version 3, or (at your option)
506 +// any later version.
508 +// This library is distributed in the hope that it will be useful,
509 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
510 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
511 +// GNU General Public License for more details.
513 +// You should have received a copy of the GNU General Public License along
514 +// with this library; see the file COPYING3. If not see
515 +// <http://www.gnu.org/licenses/>.
517 +// 20.8.3 Class template reference_wrapper
519 +// { dg-do compile }
520 +// { dg-options "-std=gnu++0x" }
522 +#include <functional>
530 + std::ref(1); // { dg-error "deleted" }
531 + std::cref(1); // { dg-error "deleted" }
532 + std::ref( int() ); // { dg-error "deleted" }
533 + std::cref( int() ); // { dg-error "deleted" }
534 + std::ref(rval()); // { dg-error "deleted" }
535 + std::cref(rvalref()); // { dg-error "deleted" }
543 +// { dg-excess-errors "" }
544 diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc
546 index 0000000..2fea52e
548 +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc
550 +// { dg-options "-std=gnu++0x" }
551 +// { dg-do compile }
553 +// Copyright (C) 2011 Free Software Foundation, Inc.
555 +// This file is part of the GNU ISO C++ Library. This library is free
556 +// software; you can redistribute it and/or modify it under the
557 +// terms of the GNU General Public License as published by the
558 +// Free Software Foundation; either version 3, or (at your option)
559 +// any later version.
561 +// This library is distributed in the hope that it will be useful,
562 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
563 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
564 +// GNU General Public License for more details.
566 +// You should have received a copy of the GNU General Public License along
567 +// with this library; see the file COPYING3. If not see
568 +// <http://www.gnu.org/licenses/>.
570 +#include <functional>
571 +#include <type_traits>
577 + typedef int argument_type;
582 + typedef float first_argument_type;
587 + typedef char second_argument_type;
590 +struct S01 : S0, S1 { };
591 +struct S02 : S0, S2 { };
592 +struct S12 : S1, S2 { };
594 +struct S012 : S0, S1, S2 { };
596 +using std::__sfinae_types;
597 +using std::integral_constant;
598 +using std::remove_cv;
600 +_GLIBCXX_HAS_NESTED_TYPE(argument_type)
601 +_GLIBCXX_HAS_NESTED_TYPE(first_argument_type)
602 +_GLIBCXX_HAS_NESTED_TYPE(second_argument_type)
604 +template<typename T>
605 + struct has_arg_type : __has_argument_type<T>
608 +template<typename T>
609 + struct has_1st_arg_type : __has_first_argument_type<T>
612 +template<typename T>
613 + struct has_2nd_arg_type : __has_second_argument_type<T>
616 +template<typename T, bool = has_arg_type<T>::value>
617 +struct test_arg_type
619 + static_assert( !has_arg_type<std::reference_wrapper<T>>::value,
620 + "reference_wrapper has no nested argument_type");
623 +template<typename T>
624 +struct test_arg_type<T, true>
626 + typedef std::reference_wrapper<T> ref;
628 + static_assert( has_arg_type<ref>::value,
629 + "reference_wrapper has nested argument_type");
632 + std::is_same< typename T::argument_type,
633 + typename ref::argument_type >::value,
634 + "reference_wrapper has the correct argument_type");
637 +template<typename T,
638 + bool = has_1st_arg_type<T>::value && has_2nd_arg_type<T>::value>
639 +struct test_1st_2nd_arg_types
641 + typedef std::reference_wrapper<T> ref;
643 + static_assert( !has_1st_arg_type<ref>::value,
644 + "reference_wrapper has no nested first_argument_type");
646 + static_assert( !has_2nd_arg_type<ref>::value,
647 + "reference_wrapper has no nested second_argument_type");
650 +template<typename T>
651 +struct test_1st_2nd_arg_types<T, true>
653 + typedef std::reference_wrapper<T> ref;
655 + static_assert( has_1st_arg_type<ref>::value,
656 + "reference_wrapper has nested first_argument_type");
658 + static_assert( has_2nd_arg_type<ref>::value,
659 + "reference_wrapper has nested second_argument_type");
662 + std::is_same< typename T::first_argument_type,
663 + typename ref::first_argument_type>::value,
664 + "reference_wrapper has correct first_argument_type");
667 + std::is_same< typename T::second_argument_type,
668 + typename ref::second_argument_type>::value,
669 + "reference_wrapper has correct second_argument_type");
673 +template<typename T>
676 + test_arg_type<T> t;
677 + test_arg_type<const T> tc;
678 + test_arg_type<volatile T> tv;
679 + test_arg_type<const volatile T> tcv;
680 + test_1st_2nd_arg_types<T> t12;
681 + test_1st_2nd_arg_types<const T> t12c;
682 + test_1st_2nd_arg_types<volatile T> t12v;
683 + test_1st_2nd_arg_types<const volatile T> t12cv;
698 diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc
699 index 56ee29e..815700f 100644
700 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc
701 +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc
703 +// { dg-do compile }
704 // { dg-options "-std=gnu++0x" }
706 -// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
707 +// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
709 // This file is part of the GNU ISO C++ Library. This library is free
710 // software; you can redistribute it and/or modify it under the
713 #include <functional>
714 #include <type_traits>
715 -#include <testsuite_hooks.h>
716 -#include <testsuite_tr1.h>
718 -using namespace __gnu_test;
722 @@ -41,43 +38,18 @@ struct derives_unary_binary
726 - bool test __attribute__((unused)) = true;
728 using std::reference_wrapper;
730 - using std::is_convertible;
731 - using std::unary_function;
732 - using std::binary_function;
734 // Check result_type typedef
735 - VERIFY((is_same<reference_wrapper<int_result_type>::result_type, int>::value));
736 - VERIFY((is_same<reference_wrapper<derives_unary>::result_type, int>::value));
737 - VERIFY((is_same<reference_wrapper<derives_binary>::result_type, int>::value));
738 - VERIFY((is_same<reference_wrapper<derives_unary_binary>::result_type, int>::value));
739 - VERIFY((is_same<reference_wrapper<int(void)>::result_type, int>::value));
740 - VERIFY((is_same<reference_wrapper<int(*)(void)>::result_type, int>::value));
741 - VERIFY((is_same<reference_wrapper<int (::X::*)()>::result_type, int>::value));
742 - VERIFY((is_same<reference_wrapper<int (::X::*)(float)>::result_type, int>::value));
744 - // Check derivation from unary_function
745 - VERIFY((is_convertible<reference_wrapper<derives_unary>*, unary_function<int, int>*>::value));
746 - VERIFY((is_convertible<reference_wrapper<derives_unary_binary>*, unary_function<int, int>*>::value));
747 - VERIFY((is_convertible<reference_wrapper<int(int)>*, unary_function<int, int>*>::value));
748 - VERIFY((is_convertible<reference_wrapper<int(*)(int)>*, unary_function<int, int>*>::value));
749 - VERIFY((is_convertible<reference_wrapper<int (::X::*)()>*, unary_function< ::X*, int>*>::value));
750 - VERIFY((is_convertible<reference_wrapper<int (::X::*)() const>*, unary_function<const ::X*, int>*>::value));
751 - VERIFY((is_convertible<reference_wrapper<int (::X::*)() volatile>*, unary_function<volatile ::X*, int>*>::value));
752 - VERIFY((is_convertible<reference_wrapper<int (::X::*)() const volatile>*, unary_function<const volatile ::X*, int>*>::value));
754 - // Check derivation from binary_function
755 - VERIFY((is_convertible<reference_wrapper<derives_binary>*, binary_function<int, float, int>*>::value));
756 - VERIFY((is_convertible<reference_wrapper<derives_unary_binary>*, binary_function<int, float, int>*>::value));
757 - VERIFY((is_convertible<reference_wrapper<int(int, float)>*, binary_function<int, float, int>*>::value));
758 - VERIFY((is_convertible<reference_wrapper<int(*)(int, float)>*, binary_function<int, float, int>*>::value));
759 - VERIFY((is_convertible<reference_wrapper<int (::X::*)(float)>*, binary_function< ::X*, float, int>*>::value));
760 - VERIFY((is_convertible<reference_wrapper<int (::X::*)(float) const>*, binary_function<const ::X*, float, int>*>::value));
761 - VERIFY((is_convertible<reference_wrapper<int (::X::*)(float) volatile>*, binary_function<volatile ::X*, float, int>*>::value));
762 - VERIFY((is_convertible<reference_wrapper<int (::X::*)(float) const volatile>*, binary_function<const volatile ::X*, float, int>*>::value));
763 + static_assert( is_same<reference_wrapper<int_result_type>::result_type, int>::value, "has result_type" );
764 + static_assert( is_same<reference_wrapper<derives_unary>::result_type, int>::value, "has result_type" );
765 + static_assert( is_same<reference_wrapper<derives_binary>::result_type, int>::value, "has result_type" );
766 + static_assert( is_same<reference_wrapper<derives_unary_binary>::result_type, int>::value, "has result_type" );
767 + static_assert( is_same<reference_wrapper<int(void)>::result_type, int>::value, "has result_type" );
768 + static_assert( is_same<reference_wrapper<int(*)(void)>::result_type, int>::value, "has result_type" );
769 + static_assert( is_same<reference_wrapper<int (::X::*)()>::result_type, int>::value, "has result_type" );
770 + static_assert( is_same<reference_wrapper<int (::X::*)(float)>::result_type, int>::value, "has result_type" );