]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix regression in std::random_device default constructor
authorJonathan Wakely <jwakely@redhat.com>
Tue, 16 Oct 2018 22:42:39 +0000 (23:42 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 16 Oct 2018 22:42:39 +0000 (23:42 +0100)
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

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/random.h

index bfc9f73213ce8a3036730c687a767504b7ca824d..57a35f0faadac8a62f3a674255a8b328783d8704 100644 (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>.
index 5e994aa883601793b64bef0ae7046511bda9577c..e02a185e3f03c5101ffe61caf542abba16972633 100644 (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)