[libc-commits] [libc] Capture 'x' by reference in asinpi_polyeval lambda (PR #164404)

Ren Hiyama via libc-commits libc-commits at lists.llvm.org
Tue Oct 21 05:07:29 PDT 2025


https://github.com/renhiyama created https://github.com/llvm/llvm-project/pull/164404



Closes #164403

>From 37f193ee7a45665ded9f0768235937d1af24ddb8 Mon Sep 17 00:00:00 2001
From: Ren Hiyama <renhiyama at rovelstars.com>
Date: Tue, 21 Oct 2025 17:36:51 +0530
Subject: [PATCH] Capture 'x' by reference in asinpi_polyeval lambda (allows
 gcc to compile without errors)

Closes #164403
---
 libc/src/math/generic/asinpif16.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/math/generic/asinpif16.cpp b/libc/src/math/generic/asinpif16.cpp
index aabc0863ba527..395f4c4ebc070 100644
--- a/libc/src/math/generic/asinpif16.cpp
+++ b/libc/src/math/generic/asinpif16.cpp
@@ -77,7 +77,7 @@ LLVM_LIBC_FUNCTION(float16, asinpif16, (float16 x)) {
   };
   // polynomial evaluation using horner's method
   // work only for |x| in [0, 0.5]
-  auto asinpi_polyeval = [](double x) -> double {
+  auto asinpi_polyeval = [&](double x) -> double {
     return x * fputil::polyeval(x * x, POLY_COEFFS[0], POLY_COEFFS[1],
                                 POLY_COEFFS[2], POLY_COEFFS[3], POLY_COEFFS[4],
                                 POLY_COEFFS[5], POLY_COEFFS[6], POLY_COEFFS[7]);



More information about the libc-commits mailing list