bool.fail.cpp 685 B

1234567891011121314151617181920212223242526272829
  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. // XFAIL: c++98, c++03
  9. // <system_error>
  10. // class error_code
  11. // explicit operator bool() const;
  12. #include <system_error>
  13. bool test_func(void)
  14. {
  15. const std::error_code ec(0, std::generic_category());
  16. return ec; // conversion to bool is explicit; should fail.
  17. }
  18. int main(int, char**)
  19. {
  20. return 0;
  21. }