[libcxx-commits] [libcxx] Fix LWG issue4481 disallow chrono::duration<const T, P> (PR #207558)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 4 23:28:01 PDT 2026


================
@@ -164,6 +169,9 @@ template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duratio
 
 template <class _Rep, class _Period>
 class duration {
+#if _LIBCPP_STD_VER >= 26
+  static_assert(is_same_v<_Rep, remove_cv_t<_Rep>>, "A duration representation cannot be cv-qualified");
+#endif
----------------
frederick-vs-ja wrote:

Also, please update this line in `Cxx26Issues.csv` as indicated.
https://github.com/llvm/llvm-project/blob/7f449d38cd9d203af2be106210f3ef9c30597ebe/libcxx/docs/Status/Cxx26Issues.csv#L304

```diff
-"`LWG4481 <https://wg21.link/LWG4481>`__","Disallow ``chrono::duration<const T, P>``","2026-03 (Croydon)","","","`#189846 <https://github.com/llvm/llvm-project/issues/189846>`__",""
+"`LWG4481 <https://wg21.link/LWG4481>`__","Disallow ``chrono::duration<const T, P>``","2026-03 (Croydon)","|Complete|","23","`#189846 <https://github.com/llvm/llvm-project/issues/189846>`__",""
```

https://github.com/llvm/llvm-project/pull/207558


More information about the libcxx-commits mailing list