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 // UNSUPPORTED: c++03, c++11 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 #include "test_macros.h" 22 23 class test1 24 : public std::error_category 25 { 26 public: 27 constexpr test1() = default; // won't compile if error_category() is not constexpr name() const28 virtual const char* name() const noexcept {return nullptr;} message(int) const29 virtual std::string message(int) const {return std::string();} 30 }; 31 main(int,char **)32int main(int, char**) 33 { 34 static_assert(std::is_nothrow_default_constructible<test1>::value, 35 "error_category() must exist and be noexcept"); 36 37 return 0; 38 } 39