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// <system_error>
10
11// class error_condition
12
13// explicit operator bool() const;
14
15#include <system_error>
16#include <string>
17#include <cassert>
18
19#include "test_macros.h"
20
21int main(int, char**)
22{
23 {
24 const std::error_condition ec(6, std::generic_category());
25 assert(static_cast<bool>(ec));
26 }
27 {
28 const std::error_condition ec(0, std::generic_category());
29 assert(!static_cast<bool>(ec));
30 }
31
32 return 0;
33}
34

source code of libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/bool.pass.cpp