Patchwork [v3] libstdc++/47709

login
register
mail settings
Submitter Paolo Carlini
Date Feb. 12, 2011, 9:28 p.m.
Message ID <4D56FB71.80605@oracle.com>
Download mbox | patch
Permalink /patch/82944/
State New
Headers show

Comments

Paolo Carlini - Feb. 12, 2011, 9:28 p.m.
Hi,

tested x86_64-linux, applied mainline and 4_5-branch.

Paolo.

//////////////////
2011-02-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/47709
	* include/ext/algorithm (is_heap): In C++0x mode import from
	namespace std.
	* testsuite/ext/is_heap/47709.cc: New.

Patch

Index: include/ext/algorithm
===================================================================
--- include/ext/algorithm	(revision 170086)
+++ include/ext/algorithm	(working copy)
@@ -1,6 +1,7 @@ 
 // Algorithm extensions -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010, 2011
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -426,6 +427,9 @@ 
 			     __out_last - __out_first);
     }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  using std::is_heap;
+#else
   /**
    *  This is an SGI extension.
    *  @ingroup SGIextensions
@@ -465,6 +469,7 @@ 
 
       return std::__is_heap(__first, __comp, __last - __first);
     }
+#endif
 
   // is_sorted, a predicated testing whether a range is sorted in
   // nondescending order.  This is an extension, not part of the C++
Index: testsuite/ext/is_heap/47709.cc
===================================================================
--- testsuite/ext/is_heap/47709.cc	(revision 0)
+++ testsuite/ext/is_heap/47709.cc	(revision 0)
@@ -0,0 +1,29 @@ 
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 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/>.
+
+#include <ext/algorithm>
+#include <vector>
+
+// libstdc++/47709
+void foo()
+{
+  std::vector<int> v;
+  is_heap(v.begin(), v.end());
+}