This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][libstdc++-v3 parallel mode] Patch for PR 39546


Paolo Carlini wrote:
> Hi,
>> As discussed.
>>
>> Tested x86_64-unknown-linux-gnu: No regressions
>>
>> Please approve for mainline.
>>   
> In any case, I don't see why not adding the testcase, will be also
> useful if / when we figure out a more general way to deal with
> forwarding issues...

Sorry, got you wrong, test case now included.  Have rerun regression tests.

2009-05-04  Johannes Singler  <singler@ira.uka.de>

        PR libstdc++/39546
        * include/parallel/algo.h (find_switch):
        Parametrize binder2nd with const T& instead of T.
        * testsuite/25_algorithms/find/39546.cc: new test case

Johannes

Index: include/parallel/algo.h
===================================================================
--- include/parallel/algo.h	(revision 147003)
+++ include/parallel/algo.h	(working copy)
@@ -149,8 +149,8 @@
 
       if (_GLIBCXX_PARALLEL_CONDITION(true))
         {
-          binder2nd<__gnu_parallel::equal_to<value_type, T> >
-            comp(__gnu_parallel::equal_to<value_type, T>(), val);
+          binder2nd<__gnu_parallel::equal_to<value_type, const T&> >
+            comp(__gnu_parallel::equal_to<value_type, const T&>(), val);
           return __gnu_parallel::find_template(begin, end, begin, comp,
                                                __gnu_parallel::
                                                find_if_selector()).first;
Index: testsuite/25_algorithms/find/39546.cc
===================================================================
--- testsuite/25_algorithms/find/39546.cc	(revision 0)
+++ testsuite/25_algorithms/find/39546.cc	(revision 0)
@@ -0,0 +1,36 @@
+// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.3.1 algorithms, find()
+
+#include <vector>
+#include <string>
+#include <algorithm>
+
+// libstdc++/39546
+typedef std::vector<std::string> dict;
+int main(void)
+{
+    dict test;
+    test.push_back("one");
+    test.push_back("two");
+    test.push_back("three");
+
+    if ( std::find(test.begin(), test.end(), "two") != test.end())
+        return 0;
+    return 1;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]