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