summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0309-2011-05-22-Jonathan-Wakely-jwakely.gcc-gmail.com.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0309-2011-05-22-Jonathan-Wakely-jwakely.gcc-gmail.com.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0309-2011-05-22-Jonathan-Wakely-jwakely.gcc-gmail.com.patch185
1 files changed, 185 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0309-2011-05-22-Jonathan-Wakely-jwakely.gcc-gmail.com.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0309-2011-05-22-Jonathan-Wakely-jwakely.gcc-gmail.com.patch
new file mode 100644
index 0000000000..f78604e136
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0309-2011-05-22-Jonathan-Wakely-jwakely.gcc-gmail.com.patch
@@ -0,0 +1,185 @@
1From b2acc60a75029f02cf14633a15f3a8a242257154 Mon Sep 17 00:00:00 2001
2From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Mon, 23 May 2011 00:08:52 +0000
4Subject: [PATCH] 2011-05-22 Jonathan Wakely <jwakely.gcc@gmail.com>
5
6 * testsuite/20_util/bind/cv_quals_2.cc: New.
7
82011-05-22 Paolo Carlini <paolo.carlini@oracle.com>
9
10 PR libstdc++/49058
11 * include/std/functional (_Bind<_Functor(_Bound_args...)>::
12 operator()(_Args&&...)): Don't cv qualify _Functor directly
13 in the default template argument, SFINAE doesn't apply when
14 the functor has no arguments.
15 * testsuite/20_util/bind/49058_1.cc: New.
16 * testsuite/20_util/bind/49058_2.cc: Likewise.
17
18
19git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174049 138bc75d-0d04-0410-961f-82ee72b054a4
20
21index 57ec506..45bee81 100644
22--- a/libstdc++-v3/include/std/functional
23+++ b/libstdc++-v3/include/std/functional
24@@ -1207,7 +1207,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
25
26 // Call as const
27 template<typename... _Args, typename _Result
28- = decltype( std::declval<const _Functor>()(
29+ = decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0),
30+ typename add_const<_Functor>::type>::type>()(
31 _Mu<_Bound_args>()( std::declval<const _Bound_args&>(),
32 std::declval<tuple<_Args...>&>() )... ) )>
33 _Result
34@@ -1220,7 +1221,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
35
36 // Call as volatile
37 template<typename... _Args, typename _Result
38- = decltype( std::declval<volatile _Functor>()(
39+ = decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0),
40+ typename add_volatile<_Functor>::type>::type>()(
41 _Mu<_Bound_args>()( std::declval<volatile _Bound_args&>(),
42 std::declval<tuple<_Args...>&>() )... ) )>
43 _Result
44@@ -1233,7 +1235,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
45
46 // Call as const volatile
47 template<typename... _Args, typename _Result
48- = decltype( std::declval<const volatile _Functor>()(
49+ = decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0),
50+ typename add_cv<_Functor>::type>::type>()(
51 _Mu<_Bound_args>()( std::declval<const volatile _Bound_args&>(),
52 std::declval<tuple<_Args...>&>() )... ) )>
53 _Result
54diff --git a/libstdc++-v3/testsuite/20_util/bind/49058_1.cc b/libstdc++-v3/testsuite/20_util/bind/49058_1.cc
55new file mode 100644
56index 0000000..fb34e08
57--- /dev/null
58+++ b/libstdc++-v3/testsuite/20_util/bind/49058_1.cc
59@@ -0,0 +1,34 @@
60+// { dg-options "-pedantic -std=gnu++0x" }
61+// { dg-do compile }
62+
63+// Copyright (C) 2011 Free Software Foundation, Inc.
64+//
65+// This file is part of the GNU ISO C++ Library. This library is free
66+// software; you can redistribute it and/or modify it under the
67+// terms of the GNU General Public License as published by the
68+// Free Software Foundation; either version 3, or (at your option)
69+// any later version.
70+
71+// This library is distributed in the hope that it will be useful,
72+// but WITHOUT ANY WARRANTY; without even the implied warranty of
73+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
74+// GNU General Public License for more details.
75+
76+// You should have received a copy of the GNU General Public License along
77+// with this library; see the file COPYING3. If not see
78+// <http://www.gnu.org/licenses/>.
79+
80+#include <functional>
81+
82+// PR libstdc++/49058
83+
84+struct F
85+{
86+ void
87+ operator()();
88+};
89+
90+void f()
91+{
92+ std::bind( F() );
93+}
94diff --git a/libstdc++-v3/testsuite/20_util/bind/49058_2.cc b/libstdc++-v3/testsuite/20_util/bind/49058_2.cc
95new file mode 100644
96index 0000000..fc9d9a2
97--- /dev/null
98+++ b/libstdc++-v3/testsuite/20_util/bind/49058_2.cc
99@@ -0,0 +1,28 @@
100+// { dg-options "-pedantic -std=gnu++0x" }
101+// { dg-do compile }
102+
103+// Copyright (C) 2011 Free Software Foundation, Inc.
104+//
105+// This file is part of the GNU ISO C++ Library. This library is free
106+// software; you can redistribute it and/or modify it under the
107+// terms of the GNU General Public License as published by the
108+// Free Software Foundation; either version 3, or (at your option)
109+// any later version.
110+
111+// This library is distributed in the hope that it will be useful,
112+// but WITHOUT ANY WARRANTY; without even the implied warranty of
113+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114+// GNU General Public License for more details.
115+
116+// You should have received a copy of the GNU General Public License along
117+// with this library; see the file COPYING3. If not see
118+// <http://www.gnu.org/licenses/>.
119+
120+#include <functional>
121+
122+// PR libstdc++/49058
123+
124+void f()
125+{
126+ std::bind( []{} );
127+}
128diff --git a/libstdc++-v3/testsuite/20_util/bind/cv_quals_2.cc b/libstdc++-v3/testsuite/20_util/bind/cv_quals_2.cc
129new file mode 100644
130index 0000000..067d862
131--- /dev/null
132+++ b/libstdc++-v3/testsuite/20_util/bind/cv_quals_2.cc
133@@ -0,0 +1,49 @@
134+// Copyright (C) 2011 Free Software Foundation, Inc.
135+//
136+// This file is part of the GNU ISO C++ Library. This library is free
137+// software; you can redistribute it and/or modify it under the
138+// terms of the GNU General Public License as published by the
139+// Free Software Foundation; either version 3, or (at your option)
140+// any later version.
141+
142+// This library is distributed in the hope that it will be useful,
143+// but WITHOUT ANY WARRANTY; without even the implied warranty of
144+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
145+// GNU General Public License for more details.
146+
147+// You should have received a copy of the GNU General Public License along
148+// with this library; see the file COPYING3. If not see
149+// <http://www.gnu.org/licenses/>.
150+
151+// { dg-options "-std=gnu++0x" }
152+
153+#include <functional>
154+#include <testsuite_hooks.h>
155+
156+struct X
157+{
158+ int operator()() const { return 0; }
159+ int operator()() volatile { return 1; }
160+ int operator()() const volatile { return 2; }
161+ void operator()() { };
162+};
163+
164+void test01()
165+{
166+ bool test __attribute__((unused)) = true;
167+
168+ const auto b0 = std::bind(X());
169+ VERIFY( b0() == 0 );
170+
171+ volatile auto b1 = std::bind(X());
172+ VERIFY( b1() == 1 );
173+
174+ const volatile auto b2 = std::bind(X());
175+ VERIFY( b2() == 2 );
176+}
177+
178+int main()
179+{
180+ test01();
181+ return 0;
182+}
183--
1841.7.0.4
185