• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // See bugs.llvm.org/PR20183
11 //
12 // XFAIL: with_system_cxx_lib=macosx10.11
13 // XFAIL: with_system_cxx_lib=macosx10.10
14 // XFAIL: with_system_cxx_lib=macosx10.9
15 // XFAIL: with_system_cxx_lib=macosx10.8
16 // XFAIL: with_system_cxx_lib=macosx10.7
17 
18 // <random>
19 
20 // class random_device;
21 
22 // result_type operator()();
23 
24 #include <random>
25 #include <cassert>
26 #include <system_error>
27 
28 #include "test_macros.h"
29 
main()30 int main()
31 {
32     {
33         std::random_device r;
34         std::random_device::result_type e = r();
35         ((void)e); // Prevent unused warning
36     }
37 
38 #ifndef TEST_HAS_NO_EXCEPTIONS
39     try
40     {
41         std::random_device r("/dev/null");
42         (void)r();
43         LIBCPP_ASSERT(false);
44     }
45     catch (const std::system_error&)
46     {
47     }
48 #endif
49 }
50