xref: /llvm-project/libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp (revision fb42f4c44adc1e2ac25c1305e77d53e735012b77)
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // XFAIL: libcpp-no-exceptions
11 // <random>
12 
13 // class random_device;
14 
15 // result_type operator()();
16 
17 #include <random>
18 #include <cassert>
19 
20 int main()
21 {
22     {
23         std::random_device r;
24         std::random_device::result_type e = r();
25     }
26 
27     try
28     {
29         std::random_device r("/dev/null");
30         r();
31         assert(false);
32     }
33     catch (const std::system_error&)
34     {
35     }
36 }
37