ctor_error_code_const_char_pointer.pass.cpp revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
1//===----------------------------------------------------------------------===//
2//
3// ��������������������The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <system_error>
11
12// class system_error
13
14// system_error(error_code ec, const char* what_arg);
15
16// Test is slightly non-portable
17
18#include <system_error>
19#include <string>
20#include <cassert>
21
22int main()
23{
24    std::string what_arg("test message");
25    std::system_error se(make_error_code(std::errc::not_a_directory), what_arg.c_str());
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(what_arg) != std::string::npos);
29    assert(what_message.find("Not a directory") != std::string::npos);
30}
31