[PATCH] D60043: [FileCheck] Fix FileCheck.cpp compilation on Solaris

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 08:50:10 PDT 2019


jdenny added a comment.

In D60043#1449898 <https://reviews.llvm.org/D60043#1449898>, @jyknight wrote:

> Sounds like this file is missing #include <math.h> (it probably only #include <cmath>).  If it wants to use ::log10, it should #include <math.h>. If it wants to use <cmath>, it should use std::log10.
>
> Ideally, this wouldn't cause this sort of error, but see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89855 which I just filed recently about this problem -- although I didn't know it affected llvm!
>
> Why this is broken only in solaris -- in solaris libc, the LIBC math.h header itself defines the overloads for float, and long double in C++ (in addition to the usual C double). But, they do not define the C++11 "any-int-type" overload. Thus, you get the ambiguous overloads resulting from this GCC bug only on solaris. On other platforms, you just see only the double overload. Which in this instance is fine, but if you were passing a float or long double, may not be!


Would including <cmath> and instead calling std::log10 avoid the problem without the explicit cast?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60043/new/

https://reviews.llvm.org/D60043





More information about the llvm-commits mailing list