Fix regression in std::random_device default constructor

When the default constructor was split out into a separate function (in
r261522) I accidentally  made it call _M_init("mt19937") instead of
_M_init_pretr1("mt19937"). That means it will always throw an exception,
because "mt19937" isn't a valid token accepted by the _M_init function.
Restore the original behaviour by calling _M_init_pretr1("mt19937").

	* include/bits/random.h (random_device) [!_GLIBCXX_USE_DEV_RANDOM]:
	Fix default constructor to call correct function.

From-SVN: r265218
This commit is contained in:
Jonathan Wakely 2018-10-16 23:42:39 +01:00 committed by Jonathan Wakely
parent 01982cfbe7
commit ec2e0ad5ea
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2018-10-16 Jonathan Wakely <jwakely@redhat.com>
* include/bits/random.h (random_device) [!_GLIBCXX_USE_DEV_RANDOM]:
Fix default constructor to call correct function.
* testsuite/experimental/net/internet/address/v4/creation.cc: Do not
declare ip in global namespace, to avoid collision with struct ip
defined in <netinet/ip.h>.

View File

@ -1611,7 +1611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~random_device()
{ _M_fini(); }
#else
random_device() { _M_init("mt19937"); }
random_device() { _M_init_pretr1("mt19937"); }
explicit
random_device(const std::string& __token)