Home | History | Annotate | Download | only in rand.device
      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 
     27 #include "test_macros.h"
     28 
     29 int main()
     30 {
     31     {
     32         std::random_device r;
     33         std::random_device::result_type e = r();
     34         ((void)e); // Prevent unused warning
     35     }
     36 
     37 #ifndef TEST_HAS_NO_EXCEPTIONS
     38     try
     39     {
     40         std::random_device r("/dev/null");
     41         (void)r();
     42         LIBCPP_ASSERT(false);
     43     }
     44     catch (const std::system_error&)
     45     {
     46     }
     47 #endif
     48 }
     49