[libcxx-commits] [libcxx] [libc++][string] Assert resize_and_overwrite operation returns integer-like type (PR #162030)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 6 02:52:08 PDT 2025


================
@@ -1311,6 +1311,8 @@ public:
 #  if _LIBCPP_STD_VER >= 23
   template <class _Op>
   _LIBCPP_HIDE_FROM_ABI constexpr void resize_and_overwrite(size_type __n, _Op __op) {
+    using __result_type = decltype(std::move(__op)(data(), auto(__n)));
+    static_assert(std::__integer_like<__result_type>, "Operation return type must be integer-like");
----------------
philnik777 wrote:

```suggestion
    static_assert(__integer_like<__result_type>, "Operation return type must be integer-like");
```

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


More information about the libcxx-commits mailing list