On target systems that don't support any random_device, not even the default one, other random_device constructor tests are disabled by dg-require-effective-target random_device. The token.cc also exercises the default constructor, in a way that doesn't expect an exception to be raised, but it's not guarded by the same requirement.
Other potentially-raising ctors in token.cc expect exceptions and handle them, but the ("default")-constructed one does not, so the program terminates and the test fails without exercising the other constructor variants. This patch arranges to disable the test altogether when the random_device feature is not available. A reasonable alternative would be to install a std::runtime_error handler around the test01 body, so that we exercise at least the exception raising, but then test03 would have to be relaxed, since without even "default", it likely wouldn't meet the tested requirement there. Regstrapped on x86_64-linux-gnu and cross-tested for x86_64-vx7r2 along with other patches, mostly for the testsuite. Ok to install? for libstdc++-v3/ChangeLog * testsuite/26_numerics/random/random_device/cons/token.cc: Require effective target feature random_device. --- .../26_numerics/random/random_device/cons/token.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc index defb8d58c586a..105ae0ba87743 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc @@ -1,4 +1,5 @@ // { dg-do run { target c++11 } } +// { dg-require-effective-target random_device } // { dg-require-cstdint "" } // // 2008-11-24 Edward M. Smith-Rowland <3dw...@verizon.net> -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Vim, Vi, Voltei pro Emacs -- GNUlius Caesar