blob: e319e0f4eed39f95c9b6852b68a14485c397e4bf [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
Asiri Rathnayakef520c142015-11-10 11:41:22 +000010// XFAIL: libcpp-no-exceptions
Howard Hinnant3e519522010-05-11 19:42:16 +000011// <random>
12
13// class random_device;
14
15// result_type operator()();
16
17#include <random>
18#include <cassert>
19
20int main()
21{
David Majnemer2dfdfdf2014-06-03 02:40:39 +000022 {
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 }
Eric Fiselierfb42f4c2016-05-02 19:15:48 +000033 catch (const std::system_error&)
David Majnemer2dfdfdf2014-06-03 02:40:39 +000034 {
35 }
Howard Hinnant3e519522010-05-11 19:42:16 +000036}