xref: /llvm-project/libcxx/test/std/time/time.hms/hhmmss.verify.cpp (revision 9bb9ec380ace81d040d3a0a0a2ae9a75733ab330)
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++03, c++11, c++14, c++17
9 
10 // <chrono>
11 
12 // template <class Duration> class hh_mm_ss;
13 //   If Duration is not an instance of duration, the program is ill-formed.
14 
15 #include <chrono>
16 #include <string>
17 #include <cassert>
18 #include "test_macros.h"
19 
20 struct A {};
21 
main(int,char **)22 int main(int, char**)
23 {
24     std::chrono::hh_mm_ss<void> h0;        // expected-error-re@*:* {{static assertion failed{{.*}}template parameter of hh_mm_ss must be a std::chrono::duration}}
25     std::chrono::hh_mm_ss<int> h1;         // expected-error-re@*:* {{static assertion failed{{.*}}template parameter of hh_mm_ss must be a std::chrono::duration}}
26     std::chrono::hh_mm_ss<std::string> h2; // expected-error-re@*:* {{static assertion failed{{.*}}template parameter of hh_mm_ss must be a std::chrono::duration}}
27     std::chrono::hh_mm_ss<A> h3;           // expected-error-re@*:* {{static assertion failed{{.*}}template parameter of hh_mm_ss must be a std::chrono::duration}}
28 
29     return 0;
30 }
31