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 error_category 13 14 // virtual string message(int ev) const = 0; 15 16 #include <system_error> 17 #include <cassert> 18 #include <string> 19 20 #include <stdio.h> 21 main()22int main() 23 { 24 const std::error_category& e_cat1 = std::generic_category(); 25 const std::error_category& e_cat2 = std::system_category(); 26 std::string m1 = e_cat1.message(5); 27 std::string m2 = e_cat2.message(5); 28 std::string m3 = e_cat2.message(6); 29 assert(!m1.empty()); 30 assert(!m2.empty()); 31 assert(!m3.empty()); 32 assert(m1 == m2); 33 assert(m1 != m3); 34 } 35