[llvm-branch-commits] [libcxx] [libc++][TZDB] Implements zoned_traits. (PR #91059)
Louis Dionne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jun 4 09:13:05 PDT 2024
================
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// template<class T> struct zoned_traits {};
+//
+// A specialization for const time_zone* is provided by the implementation:
+// template<> struct zoned_traits<const time_zone*> { ... }
+
+#include <chrono>
+#include <type_traits>
+
+// This test test whether non-specialized versions exhibit the expected
+// behavior. (Note these specializations are not really useful.)
+static_assert(std::is_trivial_v<std::chrono::zoned_traits<int>>);
----------------
ldionne wrote:
I think we actually need to check `is_empty_v && is_trivial_v` here. Otherwise a type like this would pass the `is_trivial` test:
```
struct foo {
foo();
};
```
https://github.com/llvm/llvm-project/pull/91059
More information about the llvm-branch-commits
mailing list