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:
parent
01982cfbe7
commit
ec2e0ad5ea
@ -1,5 +1,8 @@
|
|||||||
2018-10-16 Jonathan Wakely <jwakely@redhat.com>
|
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
|
* testsuite/experimental/net/internet/address/v4/creation.cc: Do not
|
||||||
declare ip in global namespace, to avoid collision with struct ip
|
declare ip in global namespace, to avoid collision with struct ip
|
||||||
defined in <netinet/ip.h>.
|
defined in <netinet/ip.h>.
|
||||||
|
@ -1611,7 +1611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
~random_device()
|
~random_device()
|
||||||
{ _M_fini(); }
|
{ _M_fini(); }
|
||||||
#else
|
#else
|
||||||
random_device() { _M_init("mt19937"); }
|
random_device() { _M_init_pretr1("mt19937"); }
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
random_device(const std::string& __token)
|
random_device(const std::string& __token)
|
||||||
|
Loading…
Reference in New Issue
Block a user