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 // <system_error>
11 
12 // class system_error
13 
14 // system_error(error_code ec);
15 
16 // Test is slightly non-portable
17 
18 #include <system_error>
19 #include <string>
20 #include <cassert>
21 
main()22 int main()
23 {
24     std::system_error se(static_cast<int>(std::errc::not_a_directory),
25                          std::generic_category(), "some text");
26     assert(se.code() == std::make_error_code(std::errc::not_a_directory));
27     std::string what_message(se.what());
28     assert(what_message.find("Not a directory") != std::string::npos);
29 }
30