I am compiling llvm on Ubuntu 20.04 LTS, with amd64 architecture, and I am compiling with gcc 11.2.0 . I haven't modified the code at all, and this is a very common architecture and popular compiler, so I am baffled by this error. I'm new to compiling compilers, but I did successfully compile and run all tests on the gcc 11.2.0 I have installed. I verified in the CMake output for llvm that it was able to locate MPFR and the correct version of gcc. I'm not sure what other info I can provide to help, but if you ask I'll add it.
I am getting this error output when compilation off llvm proper finishes, and compilation of libc gets most of the way through. What could be causing this issue?
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:249:13: error: explicit specialization in non-namespace scope ‘class __llvm_libc::testing::mpfr::MPFRNumber’
249 | template <> float as<float>() const { return mpfr_get_flt(value, MPFR_RNDN); }
| ^
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:249:21: error: template-id ‘as<float>’ in declaration of primary template
249 | template <> float as<float>() const { return mpfr_get_flt(value, MPFR_RNDN); }
| ^~~~~~~~~
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:250:13: error: explicit specialization in non-namespace scope ‘class __llvm_libc::testing::mpfr::MPFRNumber’
250 | template <> double as<double>() const { return mpfr_get_d(value, MPFR_RNDN); }
| ^
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:250:22: error: template-id ‘as<double>’ in declaration of primary template
250 | template <> double as<double>() const { return mpfr_get_d(value, MPFR_RNDN); }
| ^~~~~~~~~~
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:250:22: error: ‘double __llvm_libc::testing::mpfr::MPFRNumber::as() const’ cannot be overloaded with ‘float __llvm_libc::testing::mpfr::MPFRNumber::as() const’
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:249:21: note: previous declaration ‘float __llvm_libc::testing::mpfr::MPFRNumber::as() const’
249 | template <> float as<float>() const { return mpfr_get_flt(value, MPFR_RNDN); }
| ^~~~~~~~~
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:251:13: error: explicit specialization in non-namespace scope ‘class __llvm_libc::testing::mpfr::MPFRNumber’
251 | template <> long double as<long double>() const {
| ^
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:251:27: error: template-id ‘as<long double>’ in declaration of primary template
251 | template <> long double as<long double>() const {
| ^~~~~~~~~~~~~~~
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:251:27: error: ‘long double __llvm_libc::testing::mpfr::MPFRNumber::as() const’ cannot be overloaded with ‘float __llvm_libc::testing::mpfr::MPFRNumber::as() const’
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:249:21: note: previous declaration ‘float __llvm_libc::testing::mpfr::MPFRNumber::as() const’
249 | template <> float as<float>() const { return mpfr_get_flt(value, MPFR_RNDN); }
| ^~~~~~~~~
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp: In function ‘mpfr_rnd_t __llvm_libc::testing::mpfr::internal::getMPFRRoundingMode(__llvm_libc::testing::mpfr::RoundingMode)’:
~/Downloads/llvm-project-llvmorg-13.0.0/libc/utils/MPFRWrapper/MPFRUtils.cpp:734:1: warning: control reaches end of non-void function [-Wreturn-type]
734 | }
| ^