blob: 0573ef862efd73bbd4cf3c22518dfa27a238bb38 [file] [log] [blame]
Howard Hinnant8a1df3c2013-08-22 17:41:48 +00001//===----------------------------------------------------------------------===//
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 error_category
13
14// constexpr error_category() noexcept;
15
16#include <system_error>
17#include <type_traits>
18#include <string>
19#include <cassert>
20
21#if _LIBCPP_STD_VER > 11
22
23class test1
24 : public std::error_category
25{
26public:
27 constexpr test1() = default; // won't compile if error_category() is not constexpr
28 virtual const char* name() const noexcept {return nullptr;}
Dan Albert1d4a1ed2016-05-25 22:36:09 -070029 virtual std::string message(int ev) const {return std::string();}
Howard Hinnant8a1df3c2013-08-22 17:41:48 +000030};
31
32#endif // _LIBCPP_STD_VER > 11
33
34int main()
35{
36#if _LIBCPP_STD_VER > 11
37 static_assert(std::is_nothrow_default_constructible<test1>::value,
38 "error_category() must exist and be noexcept");
39#endif // _LIBCPP_STD_VER > 11
40}