[libcxx-commits] [libcxx] [libc++][chrono] Implement LWG 4481: disallow chrono::duration<const T, P> (PR #207558)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 5 08:18:12 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
----------------
emmett2020 wrote:
Many thanks. I've updated the code.
- The fix now applies to C++03, C++11, and later versions.
- For the assertion message, I used "can not" instead of "cannot" to match the style of the is_duration_v check — they're similar.
- I've also updated Cxx26Issues.csv. Thanks again for your careful review.
https://github.com/llvm/llvm-project/pull/207558
More information about the libcxx-commits
mailing list