1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <system_error>
10 
11 // class error_category
12 
13 // virtual string message(int ev) const = 0;
14 
15 #include <system_error>
16 #include <cassert>
17 #include <string>
18 
19 #include <stdio.h>
20 
21 int main(int, char**)
22 {
23     const std::error_category& e_cat1 = std::generic_category();
24     const std::error_category& e_cat2 = std::system_category();
25     std::string m1 = e_cat1.message(5);
26     std::string m2 = e_cat2.message(5);
27     std::string m3 = e_cat2.message(6);
28     assert(!m1.empty());
29     assert(!m2.empty());
30     assert(!m3.empty());
31     assert(m1 == m2);
32     assert(m1 != m3);
33 
34   return 0;
35 }
36