813ad9c4dd
This fixes a division by zero in the selection-sampling std::__sample overload when the input range is empty (and hence __unsampled_sz is 0). libstdc++-v3/ChangeLog: * include/bits/stl_algo.h (__sample): Exit early when the input range is empty. * testsuite/25_algorithms/sample/3.cc: New test.