15a83710eSEric Fiselier //===----------------------------------------------------------------------===// 25a83710eSEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65a83710eSEric Fiselier // 75a83710eSEric Fiselier //===----------------------------------------------------------------------===// 85a83710eSEric Fiselier 9*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11 105a83710eSEric Fiselier // <system_error> 115a83710eSEric Fiselier 125a83710eSEric Fiselier // class error_category 135a83710eSEric Fiselier 145a83710eSEric Fiselier // constexpr error_category() noexcept; 155a83710eSEric Fiselier 165a83710eSEric Fiselier #include <system_error> 175a83710eSEric Fiselier #include <type_traits> 185a83710eSEric Fiselier #include <string> 195a83710eSEric Fiselier #include <cassert> 205a83710eSEric Fiselier 217fc6a556SMarshall Clow #include "test_macros.h" 227fc6a556SMarshall Clow 235a83710eSEric Fiselier class test1 245a83710eSEric Fiselier : public std::error_category 255a83710eSEric Fiselier { 265a83710eSEric Fiselier public: 275a83710eSEric Fiselier constexpr test1() = default; // won't compile if error_category() is not constexpr name() const285a83710eSEric Fiselier virtual const char* name() const noexcept {return nullptr;} message(int) const297626f778SEric Fiselier virtual std::string message(int) const {return std::string();} 305a83710eSEric Fiselier }; 315a83710eSEric Fiselier main(int,char **)322df59c50SJF Bastienint main(int, char**) 335a83710eSEric Fiselier { 345a83710eSEric Fiselier static_assert(std::is_nothrow_default_constructible<test1>::value, 355a83710eSEric Fiselier "error_category() must exist and be noexcept"); 362df59c50SJF Bastien 372df59c50SJF Bastien return 0; 385a83710eSEric Fiselier } 39