diff mbox

Resolve ambiguities in std::experimental::sample test

Message ID 20161014193948.GA28307@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Oct. 14, 2016, 7:39 p.m. UTC
With --target_board=unix/-std=gnu++17 this test fails, because
std::sample is defined too.

	* testsuite/experimental/algorithm/sample.cc: Qualify calls to
	resolve ambiguity between std::sample and std::experimental::sample.

Tested x86_64-linux, committed to trunk.
commit 8129c87b2dcd834a8a4d3d165f60e6fb295a4d79
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Oct 14 20:33:38 2016 +0100

    Resolve ambiguities in std::experimental::sample test
    
    	* testsuite/experimental/algorithm/sample.cc: Qualify calls to
    	resolve ambiguity between std::sample and std::experimental::sample.
diff mbox

Patch

diff --git a/libstdc++-v3/testsuite/experimental/algorithm/sample.cc b/libstdc++-v3/testsuite/experimental/algorithm/sample.cc
index 16e6a74..e3c25e8 100644
--- a/libstdc++-v3/testsuite/experimental/algorithm/sample.cc
+++ b/libstdc++-v3/testsuite/experimental/algorithm/sample.cc
@@ -28,7 +28,6 @@ 
 
 std::mt19937 rng;
 
-using std::experimental::sample;
 using std::istream_iterator;
 using std::ostream_iterator;
 
@@ -39,7 +38,7 @@  test01()
   int samp[10] = { };
 
   // population smaller than desired sample size
-  auto it = sample(pop, pop + 2, samp, 10, rng);
+  auto it = std::experimental::sample(pop, pop + 2, samp, 10, rng);
   VERIFY( it == samp + 2 );
   VERIFY( std::accumulate(samp, samp + 10, 0) == 3 );
 }
@@ -50,7 +49,7 @@  test02()
   const int pop[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
   int samp[10] = { };
 
-  auto it = sample(pop, std::end(pop), samp, 10, rng);
+  auto it = std::experimental::sample(pop, std::end(pop), samp, 10, rng);
   VERIFY( it == samp + 10 );
 
   std::sort(samp, it);
@@ -65,7 +64,9 @@  test03()
   int samp[5] = { };
 
   // input iterator for population
-  auto it = sample(istream_iterator<int>{pop}, {}, samp, 5, rng);
+  auto it = std::experimental::sample(istream_iterator<int>{pop}, {},
+                                      samp,
+                                      5, rng);
   VERIFY( it == samp + 5 );
 
   std::sort(samp, it);
@@ -80,7 +81,9 @@  test04()
   std::stringstream samp;
 
   // forward iterator for population and output iterator for result
-  sample(pop.begin(), pop.end(), ostream_iterator<int>{samp, " "}, 5, rng);
+  std::experimental::sample(pop.begin(), pop.end(),
+                            ostream_iterator<int>{samp, " "},
+                            5, rng);
 
   // samp.rdbuf()->pubseekoff(0, std::ios::beg);
   std::vector<int> v(istream_iterator<int>{samp}, {});