• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // UNSUPPORTED: c++98, c++03, c++11
11 // <system_error>
12 
13 // class error_category
14 
15 // constexpr error_category() noexcept;
16 
17 #include <system_error>
18 #include <type_traits>
19 #include <string>
20 #include <cassert>
21 
22 class test1
23     : public std::error_category
24 {
25 public:
26     constexpr test1() = default;  // won't compile if error_category() is not constexpr
name() const27     virtual const char* name() const noexcept {return nullptr;}
message(int) const28     virtual std::string message(int) const {return std::string();}
29 };
30 
main()31 int main()
32 {
33     static_assert(std::is_nothrow_default_constructible<test1>::value,
34                                  "error_category() must exist and be noexcept");
35 }
36