Dear all,

  The type of LDBL_MIN, LDBL_MAX, LDBL_DENORM, and LDBL_EPSILO
are not always equal to "long double" on every architecture (ARM or MIPS).
This will cause some problem in overloaded method resolution and template
instantiation.

For example, here's a piece of simplified code from STLport:

template <class _Tp>
static complex<_Tp> tanT(const complex<_Tp>& z, const _Tp& Tp_limit) { ... }

complex<long double> tan(const complex<long double>& z)
{ return tanT(z, *::log(LDBL_MAX)*); }

  Since LDBL_MAX is defined as a double-typed literal, the compiler will
choose *double ::log(double)* in the overloaded method resolution.  Then,
we will call tanT(const complex<*long double*>&, *double*),
which is undefined (or precisely, bailed the template instantiation).

  Although the C/C++ standards do not specified the type of the LDBL_*,
however I believe we should define them as long double, regardless the
target
implementation for long double.  This is also the behaviour documented in
the glibc 
document<http://www.gnu.org/software/libc/manual/html_mono/libc.html#Floating-Point-Parameters>
.

  I hope the attached patch can fix this issue.  Please have a look.
Thanks.

Sincerely,
Logan

Attachment: 0001-Use-proper-literal-postfix-for-DBL_-and-LDBL_.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to