summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0173-2011-04-23-Jonathan-Wakely-jwakely.gcc-gmail.com.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2011-06-17 17:11:43 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-23 11:50:07 +0100
commit0faa5f72999fea82fadda8bab70abea2303216c7 (patch)
tree05a8c18d2f67d883f94d2bd6f060ab0f4ac7f156 /meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0173-2011-04-23-Jonathan-Wakely-jwakely.gcc-gmail.com.patch
parentc2007ba4cdb64fa9e308d3dae395c03ef4cc9161 (diff)
downloadpoky-0faa5f72999fea82fadda8bab70abea2303216c7.tar.gz
gcc-4.6: Switch to using svn SRC_URI for recipe
We call the recipes 4.6 Remove the backport patches (From OE-Core rev: 68b545f4ff719f2b6e57d68b002dc9845c7a14ae) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0173-2011-04-23-Jonathan-Wakely-jwakely.gcc-gmail.com.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0173-2011-04-23-Jonathan-Wakely-jwakely.gcc-gmail.com.patch776
1 files changed, 0 insertions, 776 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0173-2011-04-23-Jonathan-Wakely-jwakely.gcc-gmail.com.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0173-2011-04-23-Jonathan-Wakely-jwakely.gcc-gmail.com.patch
deleted file mode 100644
index bef49b567c..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0173-2011-04-23-Jonathan-Wakely-jwakely.gcc-gmail.com.patch
+++ /dev/null
@@ -1,776 +0,0 @@
1From 0755fde6008ab7a7ae98f3b4c5967191408431f3 Mon Sep 17 00:00:00 2001
2From: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Sat, 23 Apr 2011 17:51:31 +0000
4Subject: [PATCH] 2011-04-23 Jonathan Wakely <jwakely.gcc@gmail.com>
5
6 PR libstdc++/48521
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
17 member.
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.
24
25
26
27git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172901 138bc75d-0d04-0410-961f-82ee72b054a4
28
29index 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;
34 };
35
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
39- {
40- typedef _Tp type;
41- };
42-
43- template<typename _Tp>
44- struct _Function_to_function_pointer<_Tp, true>
45- {
46- typedef _Tp* type;
47- };
48-
49 /**
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
58 >::type
59 __invoke(_Functor& __f, _Args&&... __args)
60 {
61 return __f(std::forward<_Args>(__args)...);
62 }
63
64+ template<typename _Functor, typename... _Args>
65+ inline
66+ typename enable_if<
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
71+ >::type
72+ __invoke(_Functor& __f, _Args&&... __args)
73+ {
74+ return mem_fn(__f)(std::forward<_Args>(__args)...);
75+ }
76+
77 // To pick up function references (that will become function pointers)
78 template<typename _Functor, typename... _Args>
79 inline
80 typename enable_if<
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
85 >::type
86 __invoke(_Functor __f, _Args&&... __args)
87 {
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;
91
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>
97 { };
98
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>
105- { };
106+ : _Weak_result_type<_Tp>
107+ {
108+ typedef typename _Tp::argument_type argument_type;
109+ };
110
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>
118- { };
119+ : _Weak_result_type<_Tp>
120+ {
121+ typedef typename _Tp::first_argument_type first_argument_type;
122+ typedef typename _Tp::second_argument_type second_argument_type;
123+ };
124
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>
136 {
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;
141 };
142
143+ _GLIBCXX_HAS_NESTED_TYPE(argument_type)
144+ _GLIBCXX_HAS_NESTED_TYPE(first_argument_type)
145+ _GLIBCXX_HAS_NESTED_TYPE(second_argument_type)
146+
147 /**
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,
159 _Tp>
160 { };
161
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>
165 {
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
169- _M_func_type;
170-
171 _Tp* _M_data;
172+
173 public:
174 typedef _Tp type;
175
176@@ -456,7 +456,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
177 { return *_M_data; }
178
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
183 {
184 return __invoke(get(), std::forward<_Args>(__args)...);
185@@ -476,6 +476,12 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
186 cref(const _Tp& __t)
187 { return reference_wrapper<const _Tp>(__t); }
188
189+ template<typename _Tp>
190+ void ref(const _Tp&&) = delete;
191+
192+ template<typename _Tp>
193+ void cref(const _Tp&&) = delete;
194+
195 /// Partial specialization.
196 template<typename _Tp>
197 inline reference_wrapper<_Tp>
198diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
199index 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);
205
206+ template<typename _FnCheck, typename _Fn, typename... _Args>
207+ struct __async_sfinae_helper
208+ {
209+ typedef future<typename result_of<_Fn(_Args...)>::type> type;
210+ };
211+
212+ template<typename _Fn, typename... _Args>
213+ struct __async_sfinae_helper<launch, _Fn, _Args...>
214+ { };
215+
216 template<typename _Fn, typename... _Args>
217 typename
218- enable_if<!is_same<typename decay<_Fn>::type, launch>::value,
219- future<decltype(std::declval<_Fn>()(std::declval<_Args>()...))>
220- >::type
221+ __async_sfinae_helper<typename decay<_Fn>::type, _Fn, _Args...>::type
222 async(_Fn&& __fn, _Args&&... __args);
223
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>
228 inline typename
229- enable_if<!is_same<typename decay<_Fn>::type, launch>::value,
230- future<decltype(std::declval<_Fn>()(std::declval<_Args>()...))>
231- >::type
232+ __async_sfinae_helper<typename decay<_Fn>::type, _Fn, _Args...>::type
233 async(_Fn&& __fn, _Args&&... __args)
234 {
235 return async(launch::any, std::forward<_Fn>(__fn),
236diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
237index 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>
242 class result_of;
243
244+ template<typename _MemPtr, typename _Arg>
245+ struct _Result_of_memobj;
246+
247+ template<typename _Res, typename _Class, typename _Arg>
248+ struct _Result_of_memobj<_Res _Class::*, _Arg>
249+ {
250+ private:
251+ typedef _Res _Class::* _Func;
252+
253+ template<typename _Tp>
254+ static _Tp _S_get(const _Class&);
255+ template<typename _Tp>
256+ static decltype(*std::declval<_Tp>()) _S_get(...);
257+
258+ public:
259+ typedef
260+ decltype(_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>())
261+ __type;
262+ };
263+
264+ template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
265+ struct _Result_of_memfun;
266+
267+ template<typename _Res, typename _Class, typename _Arg, typename... _Args>
268+ struct _Result_of_memfun<_Res _Class::*, _Arg, _Args...>
269+ {
270+ private:
271+ typedef _Res _Class::* _Func;
272+
273+ template<typename _Tp>
274+ static _Tp _S_get(const _Class&);
275+ template<typename _Tp>
276+ static decltype(*std::declval<_Tp>()) _S_get(...);
277+
278+ public:
279+ typedef
280+ decltype((_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>())
281+ (std::declval<_Args>()...) )
282+ __type;
283+ };
284+
285+ template<bool, bool, typename _Functor, typename... _ArgTypes>
286+ struct _Result_of_impl;
287+
288 template<typename _Functor, typename... _ArgTypes>
289- struct result_of<_Functor(_ArgTypes...)>
290+ struct _Result_of_impl<false, false, _Functor, _ArgTypes...>
291 {
292 typedef
293 decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) )
294- type;
295+ __type;
296+ };
297+
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>
301+ {
302+ typedef typename _Result_of_memobj<
303+ typename remove_reference<_MemPtr>::type, _Arg>::__type
304+ __type;
305+ };
306+
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,
310+ _ArgTypes...>
311+ {
312+ typedef typename _Result_of_memfun<
313+ typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...>::__type
314+ __type;
315+ };
316+
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...>
324+ {
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
331+ type;
332 };
333
334 /**
335diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc
336index 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
339@@ -1,7 +1,7 @@
340 // { dg-options "-std=gnu++0x" }
341 // { dg-do compile }
342
343-// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
344+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
345 //
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)
349
350 void test01()
351 {
352+ test_type* null_tt = 0;
353+ const test_type* null_ttc = 0;
354 int zero;
355
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);
365
366 // libstdc++/24803
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);
376
377 // libstdc++/24803
378diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc
379new file mode 100644
380index 0000000..bd9aeb2
381--- /dev/null
382+++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-2.cc
383@@ -0,0 +1,47 @@
384+// { dg-options "-std=gnu++0x" }
385+// { dg-do compile}
386+// Copyright (C) 2011 Free Software Foundation, Inc.
387+//
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.
393+//
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.
398+//
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,
402+// USA.
403+
404+// 20.6.4 function object return types [func.ret]
405+#include <functional>
406+
407+struct X
408+{
409+ int f(int) { return 0; }
410+ int i;
411+};
412+
413+void test01()
414+{
415+ typedef int (X::*mfp)(int);
416+ typedef int X::*mp;
417+ mfp m = &X::f;
418+ mp m2 = &X::i;
419+ X x = { };
420+ std::ref(m)(x, 1);
421+ std::ref(m)(&x, 1);
422+ int& i1 = std::ref(m2)(x);
423+ int& i2 = std::ref(m2)(&x);
424+}
425+
426+int main()
427+{
428+ test01();
429+ return 0;
430+}
431diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc
432index 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
435@@ -1,6 +1,6 @@
436 // { dg-options "-std=gnu++0x" }
437
438-// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
439+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
440 //
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); }
448
449 int operator()(float x)
450 {
451@@ -69,6 +70,13 @@ void test01()
452
453 ::get_seventeen get_sev;
454 ::X x;
455+ ::X* xp = &x;
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;
462
463 const float pi = 3.14;
464
465@@ -77,8 +85,26 @@ void test01()
466 VERIFY(ref(seventeen)() == 17);
467
468 // Function pointers
469- VERIFY(cref(&truncate_float)(pi) == 3);
470- VERIFY(cref(&seventeen)() == 17);
471+ VERIFY(cref(truncate_float)(pi) == 3);
472+ VERIFY(cref(seventeen)() == 17);
473+
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);
487+
488+ // Member data pointers
489+ VERIFY(ref(p_bar)(x) == 17);
490+ VERIFY(ref(p_bar)(xp) == 17);
491
492 // Function objects
493 VERIFY(ref(get_sev)() == 17);
494diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/ref_neg.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/ref_neg.cc
495new file mode 100644
496index 0000000..947a9b0
497--- /dev/null
498+++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/ref_neg.cc
499@@ -0,0 +1,44 @@
500+// Copyright (C) 2011 Free Software Foundation, Inc.
501+//
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.
507+
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.
512+
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/>.
516+
517+// 20.8.3 Class template reference_wrapper
518+
519+// { dg-do compile }
520+// { dg-options "-std=gnu++0x" }
521+
522+#include <functional>
523+
524+struct X { };
525+X rval();
526+X&& rvalref();
527+
528+void test01()
529+{
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" }
536+}
537+
538+int main()
539+{
540+ test02();
541+}
542+
543+// { dg-excess-errors "" }
544diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc
545new file mode 100644
546index 0000000..2fea52e
547--- /dev/null
548+++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc
549@@ -0,0 +1,148 @@
550+// { dg-options "-std=gnu++0x" }
551+// { dg-do compile }
552+
553+// Copyright (C) 2011 Free Software Foundation, Inc.
554+//
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.
560+//
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.
565+//
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/>.
569+
570+#include <functional>
571+#include <type_traits>
572+
573+struct S { };
574+
575+struct S0
576+{
577+ typedef int argument_type;
578+};
579+
580+struct S1
581+{
582+ typedef float first_argument_type;
583+};
584+
585+struct S2
586+{
587+ typedef char second_argument_type;
588+};
589+
590+struct S01 : S0, S1 { };
591+struct S02 : S0, S2 { };
592+struct S12 : S1, S2 { };
593+
594+struct S012 : S0, S1, S2 { };
595+
596+using std::__sfinae_types;
597+using std::integral_constant;
598+using std::remove_cv;
599+
600+_GLIBCXX_HAS_NESTED_TYPE(argument_type)
601+_GLIBCXX_HAS_NESTED_TYPE(first_argument_type)
602+_GLIBCXX_HAS_NESTED_TYPE(second_argument_type)
603+
604+template<typename T>
605+ struct has_arg_type : __has_argument_type<T>
606+ { };
607+
608+template<typename T>
609+ struct has_1st_arg_type : __has_first_argument_type<T>
610+ { };
611+
612+template<typename T>
613+ struct has_2nd_arg_type : __has_second_argument_type<T>
614+ { };
615+
616+template<typename T, bool = has_arg_type<T>::value>
617+struct test_arg_type
618+{
619+ static_assert( !has_arg_type<std::reference_wrapper<T>>::value,
620+ "reference_wrapper has no nested argument_type");
621+};
622+
623+template<typename T>
624+struct test_arg_type<T, true>
625+{
626+ typedef std::reference_wrapper<T> ref;
627+
628+ static_assert( has_arg_type<ref>::value,
629+ "reference_wrapper has nested argument_type");
630+
631+ static_assert(
632+ std::is_same< typename T::argument_type,
633+ typename ref::argument_type >::value,
634+ "reference_wrapper has the correct argument_type");
635+};
636+
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
640+{
641+ typedef std::reference_wrapper<T> ref;
642+
643+ static_assert( !has_1st_arg_type<ref>::value,
644+ "reference_wrapper has no nested first_argument_type");
645+
646+ static_assert( !has_2nd_arg_type<ref>::value,
647+ "reference_wrapper has no nested second_argument_type");
648+};
649+
650+template<typename T>
651+struct test_1st_2nd_arg_types<T, true>
652+{
653+ typedef std::reference_wrapper<T> ref;
654+
655+ static_assert( has_1st_arg_type<ref>::value,
656+ "reference_wrapper has nested first_argument_type");
657+
658+ static_assert( has_2nd_arg_type<ref>::value,
659+ "reference_wrapper has nested second_argument_type");
660+
661+ static_assert(
662+ std::is_same< typename T::first_argument_type,
663+ typename ref::first_argument_type>::value,
664+ "reference_wrapper has correct first_argument_type");
665+
666+ static_assert(
667+ std::is_same< typename T::second_argument_type,
668+ typename ref::second_argument_type>::value,
669+ "reference_wrapper has correct second_argument_type");
670+};
671+
672+
673+template<typename T>
674+ void test()
675+ {
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;
684+ }
685+
686+int main()
687+{
688+ test<S>();
689+ test<S0>();
690+ test<S1>();
691+ test<S2>();
692+ test<S01>();
693+ test<S02>();
694+ test<S12>();
695+ test<S012>();
696+}
697+
698diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc
699index 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
702@@ -1,6 +1,7 @@
703+// { dg-do compile }
704 // { dg-options "-std=gnu++0x" }
705
706-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
707+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
708 //
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
711@@ -19,10 +20,6 @@
712
713 #include <functional>
714 #include <type_traits>
715-#include <testsuite_hooks.h>
716-#include <testsuite_tr1.h>
717-
718-using namespace __gnu_test;
719
720 struct X {};
721
722@@ -41,43 +38,18 @@ struct derives_unary_binary
723
724 void test01()
725 {
726- bool test __attribute__((unused)) = true;
727-
728 using std::reference_wrapper;
729 using std::is_same;
730- using std::is_convertible;
731- using std::unary_function;
732- using std::binary_function;
733
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));
743-
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));
753-
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" );
771 }
772
773 int main()
774--
7751.7.0.4
776