Skip to content

libc/src/__support/FPUtil/FPBits.h:111:14: error: no matching function for call to bit_cast #74258

Closed
@petrhosek

Description

@petrhosek

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions