Skip to content

[libc] GCC failing to compile libc #164403

@renhiyama

Description

@renhiyama

auto asinpi_polyeval = [](double x) -> double {

[1891/1891] Linking CXX static library lib/libc++experimental.a
[8/1479] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.asinpif16.dir/asinpif16.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.asinpif16.dir/asinpif16.cpp.o 
/usr/bin/c++ -DLIBC_NAMESPACE=__llvm_libc_22_0_0_git -I/home/ren/coding/rovelos/llvm-project/libc -isystem /home/ren/coding/rovelos/llvm-project/build/runtimes/runtimes-bins/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=gnu++17 -mavx2 -mfma -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -DLIBC_COPT_PUBLIC_PACKAGING -MD -MT libc/src/math/generic/CMakeFiles/libc.src.math.generic.asinpif16.dir/asinpif16.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.asinpif16.dir/asinpif16.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.asinpif16.dir/asinpif16.cpp.o -c /home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp: In lambda function:
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:81:40: error: ‘POLY_COEFFS’ is not captured
   81 |     return x * fputil::polyeval(x * x, POLY_COEFFS[0], POLY_COEFFS[1],
      |                                        ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:80:27: note: the lambda has no capture-default
   80 |   auto asinpi_polyeval = [](double x) -> double {
      |                           ^
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:68:20: note: ‘constexpr const double POLY_COEFFS [8]’ declared here
   68 |   constexpr double POLY_COEFFS[] = {
      |                    ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:81:56: error: ‘POLY_COEFFS’ is not captured
   81 |     return x * fputil::polyeval(x * x, POLY_COEFFS[0], POLY_COEFFS[1],
      |                                                        ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:80:27: note: the lambda has no capture-default
   80 |   auto asinpi_polyeval = [](double x) -> double {
      |                           ^
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:68:20: note: ‘constexpr const double POLY_COEFFS [8]’ declared here
   68 |   constexpr double POLY_COEFFS[] = {
      |                    ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:82:33: error: ‘POLY_COEFFS’ is not captured
   82 |                                 POLY_COEFFS[2], POLY_COEFFS[3], POLY_COEFFS[4],
      |                                 ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:80:27: note: the lambda has no capture-default
   80 |   auto asinpi_polyeval = [](double x) -> double {
      |                           ^
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:68:20: note: ‘constexpr const double POLY_COEFFS [8]’ declared here
   68 |   constexpr double POLY_COEFFS[] = {
      |                    ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:82:49: error: ‘POLY_COEFFS’ is not captured
   82 |                                 POLY_COEFFS[2], POLY_COEFFS[3], POLY_COEFFS[4],
      |                                                 ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:80:27: note: the lambda has no capture-default
   80 |   auto asinpi_polyeval = [](double x) -> double {
      |                           ^
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:68:20: note: ‘constexpr const double POLY_COEFFS [8]’ declared here
   68 |   constexpr double POLY_COEFFS[] = {
      |                    ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:82:65: error: ‘POLY_COEFFS’ is not captured
   82 |                                 POLY_COEFFS[2], POLY_COEFFS[3], POLY_COEFFS[4],
      |                                                                 ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:80:27: note: the lambda has no capture-default
   80 |   auto asinpi_polyeval = [](double x) -> double {
      |                           ^
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:68:20: note: ‘constexpr const double POLY_COEFFS [8]’ declared here
   68 |   constexpr double POLY_COEFFS[] = {
      |                    ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:83:33: error: ‘POLY_COEFFS’ is not captured
   83 |                                 POLY_COEFFS[5], POLY_COEFFS[6], POLY_COEFFS[7]);
      |                                 ^~~~~~~~~~~
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:80:27: note: the lambda has no capture-default
   80 |   auto asinpi_polyeval = [](double x) -> double {
      |                           ^
/home/ren/coding/rovelos/llvm-project/libc/src/math/generic/asinpif16.cpp:68:20: note: ‘constexpr const double POLY_COEFFS [8]’ declared here
   68 |   constexpr double POLY_COEFFS[] = {
      |                   

This can be fixed with simply adding [&] over [].

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions