[libcxx-commits] [libcxx] [libc++][chrono] Implement LWG 4481: disallow chrono::duration<const T, P> (PR #207558)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jul 5 23:21:13 PDT 2026


================
@@ -164,6 +166,8 @@ template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duratio
 
 template <class _Rep, class _Period>
 class duration {
+  static_assert(!is_const<_Rep>::value, "A duration representation can not be const-qualified");
----------------
philnik777 wrote:

Is that message worth the cost? I don't think "does not support const types" is fundamentally better than "cannot be qualified". Everybody has to pay for two class instantiations with this version, while `__is_unqualified` is just a single variable template.

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


More information about the libcxx-commits mailing list