brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 78baa5a Raw
39 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++1110// <system_error>11 12// class error_category13 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 23class test124    : public std::error_category25{26public:27    constexpr test1() = default;  // won't compile if error_category() is not constexpr28    virtual const char* name() const noexcept {return nullptr;}29    virtual std::string message(int) const {return std::string();}30};31 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