[libcxx-commits] [libcxx] [libc++] Suppress unsigned-integer-overflow warning in <charconv> (PR #225801)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 29 10:58:04 PDT 2026


================
@@ -323,7 +323,9 @@ template <template <typename> class Fn, typename... Ts>
 TEST_CONSTEXPR_CXX23 void
 run(type_list<Ts...>)
 {
-    int ls[sizeof...(Ts)] = {(Fn<Ts>{}(), 0)...};
+    // Avoid constant-folding the array initializer at compile time when Fn<Ts>{}() is constexpr.
----------------
hchataing wrote:

> Does the // Ensure "-0" does not trigger unsigned integer overflow. test above not trigger a runtime error when run with UBSan without this constant-folding change?

It does not

> If not, I think we have a bigger problem throughout our test suite and should actually fix this more fundamentally, such as preventing constant evaluation of test(); from the main() function (not sure exactly how we'd do that).

Do you have suggestions for this ?

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


More information about the libcxx-commits mailing list