<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/74258>74258</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `libc/src/__support/FPUtil/FPBits.h:111:14`: error: no matching function for call to `bit_cast`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          petrhosek
      </td>
    </tr>
</table>

<pre>
    I encountered the following error when trying to compile LLVM libc for baremetal riscv32 target:
```
/usr/local/google/home/phosek/llvm/llvm-project/build/baremetal/./bin/clang++ --target=riscv32-unknown-elf -DLIBC_NAMESPACE=__llvm_libc_18_0_0_git -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_ASSERTIONS -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/local/google/home/phosek/llvm/llvm-project/libc -isystem /usr/local/google/home/phosek/llvm/llvm-project/build/baremetal/include
/riscv32-unknown-elf --target=riscv32-unknown-elf -march=rv32imafc -mabi=ilp32f -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstrin
g-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections -fdata-sections -ffile-prefix-map=/usr/local/google/home/phosek/llvm/llvm-project/build/baremetal/runtimes/runtimes-riscv32-unknown-elf-bins=../../../../ -ffile-prefix-map=/usr/local/google/home/phosek/llvm/llvm-project/= -no-canonical-prefixes -O2 -g -DNDEBUG -std=gnu++17 --target=riscv32-unknown-elf -O2 -fpie -ffreestanding -fno-builtin -f
no-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wall -Wextra -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -UNDEBUG -MD -MT libc/src/math/generic/CMakeFiles/libc.src.math.generic.fabsl.dir/fabsl.
cpp.obj -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.fabsl.dir/fabsl.cpp.obj.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.fabsl.dir/fabsl.cpp.obj -c /usr/local/google/home/phosek/llvm/llvm-project/libc/src/math/generic/fabsl.cpp 
In file included from /usr/local/google/home/phosek/llvm/llvm-project/libc/src/math/generic/fabsl.cpp:10: 
In file included from /usr/local/google/home/phosek/llvm/llvm-project/libc/src/__support/FPUtil/BasicOperations.h:12: 
/usr/local/google/home/phosek/llvm/llvm-project/libc/src/__support/FPUtil/FPBits.h:111:14: error: no matching function for call to 'bit_cast' 
  111 |       : bits(cpp::bit_cast<UIntType>(x)) {} 
      |              ^~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/google/home/phosek/llvm/llvm-project/libc/src/__support/FPUtil/BasicOperations.h:22:13: note: in instantiation of function template specialization '__llvm_libc_18_0_0_git::fputil::FPBits<long double>::FPBits<long double, 0>' requested here 
   22 |   FPBits<T> bits(x); 
      | ^ 
/usr/local/google/home/phosek/llvm/llvm-project/libc/src/math/generic/fabsl.cpp:16:18: note: in instantiation of function template specialization '__llvm_libc_18_0_0_git::fputil::abs<long double, 0>' requested here 
   16 |   return fputil::abs(x); 
      |                  ^ 
/usr/local/google/home/phosek/llvm/llvm-project/libc/src/__support/CPP/bit.h:36:26: note: candidate template ignored: substitution failure [with To = UIntType, From = long double, $2 = cpp::enable_if_t<sizeof(UIntType) == sizeof(long double)>]: implicit instantiation of undefined template '__llvm_libc_18_0_0_git::cpp::enable_if<false>' 
   36 | LIBC_INLINE constexpr To bit_cast(const From &from) { 
      | ^ 
1 error generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WElv4zoS_jX0haBhkV7igw-2ZTeMyYbYmbybQEklia9pUo-ksrzD_PZBSYqTTtLdM6-RFgwtRbJY-uqrxZLeq9IALMhkRSbxQDahsm5RQ3CV9fB1kNr8abGjYDLbmAAOchoqoIXV2j4oU1Jwzjr6UIGhwT2hJFia2WOtNNDz839fUK3SjBbW0VQ6OEKQmjrls3vBaZCuhEDEkoxiMlqS6aj_dY9823hH-FbbTGrCt6W1pQbCt5U94qVubcQJ-v7YX1jt7J-QBcK3aaN0jtfnfQnfDvFZGcK3mZamJHxF-Ioy9mxJ3JvGGvPV2AfDQBeUxee71Tq5XF5s9tfL9YaIOElwswTfLYnOklEySkoVKIuTeLO6_YI32935JrnabvebQ7LaHfZExNMxDnxBbX_8kSz3-83NYXd1uUfp-fLmy6Zds7-6vVlvUJbsD_E6WV9d7g_Ly0NysVzfXO1fBrZXNxfL9-Lz3cXuRbr7VRhb_zHln3yAI_0MpyiT6SaHk9c_9MFPXHSULqtw8F5wdZRFhqJUERErXQteUFZc79aUFcYyD0dpgsqYQkrX1qugrKGsuFdepUqr8MSU0cqAZ5XKczCU3bVEJyLOZQAW1BFeyRpTNtLlkDN5L5WWvQ4DD5TdSa1x6mNwkrI7Y1ljGg85q6WTRwjgKLt7cCoA88EpU3rK7jLpA_urkbjyqLxXpmSFAp0zZVRQUqu_weFEday1ylRghdQ6VM42ZYXr7T3GKvMPKmQVy6GQjQ7d9sbCYwZ1YOGphlZk2L1yoZGa5cGiOTloCMA-GPFNWYIPDPU7leP61urOdyXLrLkH51s40XINMkfjlcnBBNnhfJcFmbOjfEqBNcY3dW1dgJyyomhMhnOYh_bqKStyGeTr50JpYLWDQj2yo6yJiD-Dk64x6GT_6pZ9QDyWKuOJiIeYWN6cPsVWImLKjGWZ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