hhmmss.fail.cpp 1.4 KB

123456789101112131415161718192021222324252627282930
  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. // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
  9. // UNSUPPORTED: apple-clang-9
  10. // <chrono>
  11. // template <class Duration> class hh_mm_ss;
  12. // If Duration is not an instance of duration, the program is ill-formed.
  13. #include <chrono>
  14. #include <string>
  15. #include <cassert>
  16. #include "test_macros.h"
  17. struct A {};
  18. int main(int, char**)
  19. {
  20. std::chrono::hh_mm_ss<void> h0; // expected-error-re@chrono:* {{static_assert failed {{.*}} "template parameter of hh_mm_ss must be a std::chrono::duration"}}
  21. std::chrono::hh_mm_ss<int> h1; // expected-error-re@chrono:* {{static_assert failed {{.*}} "template parameter of hh_mm_ss must be a std::chrono::duration"}}
  22. std::chrono::hh_mm_ss<std::string> h2; // expected-error-re@chrono:* {{static_assert failed {{.*}} "template parameter of hh_mm_ss must be a std::chrono::duration"}}
  23. std::chrono::hh_mm_ss<A> h3; // expected-error-re@chrono:* {{static_assert failed {{.*}} "template parameter of hh_mm_ss must be a std::chrono::duration"}}
  24. return 0;
  25. }