blob: e5a2a32ee26100ba19de734f22a1a2673075f2c3 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant3e519522010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
Eric Fiselier37dc68c2017-05-05 05:19:21 +000010// See bugs.llvm.org/PR20183
11//
Mehdi Aminie9c66ad2017-05-04 17:08:54 +000012// 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
Howard Hinnant3e519522010-05-11 19:42:16 +000018// <random>
19
20// class random_device;
21
22// result_type operator()();
23
24#include <random>
25#include <cassert>
Marshall Clow4fe52c72018-03-07 22:51:16 +000026#include <system_error>
Howard Hinnant3e519522010-05-11 19:42:16 +000027
Eric Fiselier0a707552016-06-15 01:50:31 +000028#include "test_macros.h"
29
Howard Hinnant3e519522010-05-11 19:42:16 +000030int main()
31{
David Majnemer2dfdfdf2014-06-03 02:40:39 +000032 {
33 std::random_device r;
34 std::random_device::result_type e = r();
Stephan T. Lavavej4dc0ed82016-11-14 17:35:14 +000035 ((void)e); // Prevent unused warning
David Majnemer2dfdfdf2014-06-03 02:40:39 +000036 }
37
Roger Ferrer Ibanez8cba0be2016-11-01 08:11:12 +000038#ifndef TEST_HAS_NO_EXCEPTIONS
David Majnemer2dfdfdf2014-06-03 02:40:39 +000039 try
40 {
41 std::random_device r("/dev/null");
Billy Robert O'Neal III1c240a82017-11-15 07:45:07 +000042 (void)r();
Eric Fiselier0a707552016-06-15 01:50:31 +000043 LIBCPP_ASSERT(false);
David Majnemer2dfdfdf2014-06-03 02:40:39 +000044 }
Eric Fiselierfb42f4c2016-05-02 19:15:48 +000045 catch (const std::system_error&)
David Majnemer2dfdfdf2014-06-03 02:40:39 +000046 {
47 }
Roger Ferrer Ibanez8cba0be2016-11-01 08:11:12 +000048#endif
Howard Hinnant3e519522010-05-11 19:42:16 +000049}