[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ problems with clang-cl in math.h

From: Gisle Vanem
Subject: C++ problems with clang-cl in math.h
Date: Thu, 2 Nov 2017 15:10:41 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Hello list.

I'm trying to use Gnulib's <math.h> from clang-cl C++
compiler. I have no problems with pure C with either clang-cl
or MSVC. But in C++ I get endless troubles with errors like these:

  f:/MingW32/src/gnu/gnulib/lib\math.h(2397,36): error: functions that
  differ only in their return type cannot be overloaded

Thanks to the excellent 'clang-format' program, I was able to generate
this preprocessed output:

// from MSVC and UCRT's <corecrt_math.h>:

inline bool signbit(float _X) throw()
  return _fdsign(_X) != 0;
inline bool signbit(double _X) throw()
  return _dsign(_X) != 0;
inline bool signbit(long double _X) throw()
  return _ldsign(_X) != 0;

// and then from Gnulib's <math.h>:

inline int signbit(float f)
  return _gl_cxx_signbitf(f);
inline int signbit(double d)
  return _gl_cxx_signbitd(d);
inline int signbit(long double l)
  return _gl_cxx_signbitl(l);

I'm getting these error even without a 'REPLACE_SIGNBIT=1'.
And I fail to see how to prevent the above from getting into

I'm not C++ export, but would imagine that 'int' and 'bool'
are different types. Or does the 'throw()' have anything to do with
this error? Any hints please?

PS. I've tried clang-cl v3.9.0 and 5.0.0 with the same result.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]