+2011-05-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/48933
+ * include/c_global/cmath (acosh, asinh, atanh, cbrt, copysign,
+ erf, erfc, exp2, expm1, fdim, fma, fmax, hypot, ilogb, lgamma,
+ llrint, llround, log1p, log2, logb, lrint, lround, nearbyint,
+ nextafter, nexttoward, remainder, remquo, rint, round, scalbln,
+ scalbn, tgamma, trunc): Use __enable_if on the return type.
+ * include/tr1/cmath: Likewise.
+ * testsuite/26_numerics/headers/cmath/overloads_c++0x_neg.cc: New.
+ * testsuite/tr1/8_c_compatibility/cmath/overloads_neg.cc: Likewise.
+
2011-05-07 François Dumont <francois.cppdevs@free.fr>
* include/debug/macro.h (_GLIBCXX_DEBUG_VERIFY_AT): New.
// -*- C++ -*- C forwarding header.
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009, 2010
+// 2006, 2007, 2008, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
{ return __builtin_acoshl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
acosh(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return acosh(__type(__x));
- }
+ { return __builtin_acosh(__x); }
inline float
asinh(float __x)
{ return __builtin_asinhl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
asinh(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return asinh(__type(__x));
- }
+ { return __builtin_asinh(__x); }
inline float
atanh(float __x)
{ return __builtin_atanhl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
atanh(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return atanh(__type(__x));
- }
+ { return __builtin_atanh(__x); }
inline float
cbrt(float __x)
{ return __builtin_cbrtl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
cbrt(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return cbrt(__type(__x));
- }
+ { return __builtin_cbrt(__x); }
inline float
copysign(float __x, float __y)
{ return __builtin_copysignl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
copysign(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_erfl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
erf(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return erf(__type(__x));
- }
+ { return __builtin_erf(__x); }
inline float
erfc(float __x)
{ return __builtin_erfcl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
erfc(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return erfc(__type(__x));
- }
+ { return __builtin_erfc(__x); }
inline float
exp2(float __x)
{ return __builtin_exp2l(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
exp2(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return exp2(__type(__x));
- }
+ { return __builtin_exp2(__x); }
inline float
expm1(float __x)
{ return __builtin_expm1l(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
expm1(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return expm1(__type(__x));
- }
+ { return __builtin_expm1(__x); }
inline float
fdim(float __x, float __y)
{ return __builtin_fdiml(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
fdim(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_fmal(__x, __y, __z); }
template<typename _Tp, typename _Up, typename _Vp>
- inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
+ inline
+ typename __gnu_cxx::__promote_3<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value
+ && __is_arithmetic<_Vp>::__value,
+ _Tp>::__type, _Up, _Vp>::__type
fma(_Tp __x, _Up __y, _Vp __z)
{
typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
{ return __builtin_fmaxl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
fmax(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_fminl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
fmin(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_hypotl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- hypot(_Tp __x, _Up __y)
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
+ hypot(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
return hypot(__type(__x), __type(__y));
{ return __builtin_ilogbl(__x); }
template<typename _Tp>
- inline int
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ int>::__type
ilogb(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return ilogb(__type(__x));
- }
+ { return __builtin_ilogb(__x); }
inline float
lgamma(float __x)
{ return __builtin_lgammal(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
lgamma(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return lgamma(__type(__x));
- }
+ { return __builtin_lgamma(__x); }
inline long long
llrint(float __x)
{ return __builtin_llrintl(__x); }
template<typename _Tp>
- inline long long
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ long long>::__type
llrint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return llrint(__type(__x));
- }
+ { return __builtin_llrint(__x); }
inline long long
llround(float __x)
{ return __builtin_llroundl(__x); }
template<typename _Tp>
- inline long long
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ long long>::__type
llround(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return llround(__type(__x));
- }
+ { return __builtin_llround(__x); }
inline float
log1p(float __x)
{ return __builtin_log1pl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
log1p(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return log1p(__type(__x));
- }
+ { return __builtin_log1p(__x); }
// DR 568.
inline float
{ return __builtin_log2l(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
log2(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return log2(__type(__x));
- }
+ { return __builtin_log2(__x); }
inline float
logb(float __x)
{ return __builtin_logbl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
logb(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return logb(__type(__x));
- }
+ { return __builtin_logb(__x); }
inline long
lrint(float __x)
{ return __builtin_lrintl(__x); }
template<typename _Tp>
- inline long
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ long>::__type
lrint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return lrint(__type(__x));
- }
+ { return __builtin_lrint(__x); }
inline long
lround(float __x)
{ return __builtin_lroundl(__x); }
template<typename _Tp>
- inline long
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ long>::__type
lround(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return lround(__type(__x));
- }
+ { return __builtin_lround(__x); }
inline float
nearbyint(float __x)
{ return __builtin_nearbyintl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
nearbyint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return nearbyint(__type(__x));
- }
+ { return __builtin_nearbyint(__x); }
inline float
nextafter(float __x, float __y)
{ return __builtin_nextafterl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
nextafter(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_nexttowardl(__x, __y); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
nexttoward(_Tp __x, long double __y)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return nexttoward(__type(__x), __y);
- }
+ { return __builtin_nexttoward(__x, __y); }
inline float
remainder(float __x, float __y)
{ return __builtin_remainderl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
remainder(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_remquol(__x, __y, __pquo); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
remquo(_Tp __x, _Up __y, int* __pquo)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_rintl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
rint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return rint(__type(__x));
- }
+ { return __builtin_rint(__x); }
inline float
round(float __x)
{ return __builtin_roundl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
round(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return round(__type(__x));
- }
+ { return __builtin_round(__x); }
inline float
scalbln(float __x, long __ex)
{ return __builtin_scalblnl(__x, __ex); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
scalbln(_Tp __x, long __ex)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return scalbln(__type(__x), __ex);
- }
+ { return __builtin_scalbln(__x, __ex); }
inline float
scalbn(float __x, int __ex)
{ return __builtin_scalbnl(__x, __ex); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
scalbn(_Tp __x, int __ex)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return scalbn(__type(__x), __ex);
- }
+ { return __builtin_scalbn(__x, __ex); }
inline float
tgamma(float __x)
{ return __builtin_tgammal(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
tgamma(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return tgamma(__type(__x));
- }
+ { return __builtin_tgamma(__x); }
inline float
trunc(float __x)
{ return __builtin_truncl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
trunc(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return trunc(__type(__x));
- }
+ { return __builtin_trunc(__x); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
{ return __builtin_acoshl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
acosh(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return acosh(__type(__x));
- }
+ { return __builtin_acosh(__x); }
using std::asin;
{ return __builtin_asinhl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
asinh(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return asinh(__type(__x));
- }
+ { return __builtin_asinh(__x); }
using std::atan;
using std::atan2;
{ return __builtin_atanhl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
atanh(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return atanh(__type(__x));
- }
+ { return __builtin_atanh(__x); }
inline float
cbrt(float __x)
{ return __builtin_cbrtl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
cbrt(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return cbrt(__type(__x));
- }
+ { return __builtin_cbrt(__x); }
using std::ceil;
{ return __builtin_copysignl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
copysign(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_erfl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
erf(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return erf(__type(__x));
- }
+ { return __builtin_erf(__x); }
inline float
erfc(float __x)
{ return __builtin_erfcl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
erfc(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return erfc(__type(__x));
- }
+ { return __builtin_erfc(__x); }
using std::exp;
{ return __builtin_exp2l(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
exp2(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return exp2(__type(__x));
- }
+ { return __builtin_exp2(__x); }
inline float
expm1(float __x)
{ return __builtin_expm1l(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
expm1(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return expm1(__type(__x));
- }
+ { return __builtin_expm1(__x); }
// Note: we deal with fabs in a special way, because an using std::fabs
// would bring in also the overloads for complex types, which in C++0x
{ return __builtin_fdiml(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
fdim(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_fmal(__x, __y, __z); }
template<typename _Tp, typename _Up, typename _Vp>
- inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
+ inline
+ typename __gnu_cxx::__promote_3<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value
+ && __is_arithmetic<_Vp>::__value,
+ _Tp>::__type, _Up, _Vp>::__type
fma(_Tp __x, _Up __y, _Vp __z)
{
typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
{ return __builtin_fmaxl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
fmax(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_fminl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
fmin(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_hypotl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
- hypot(_Tp __x, _Up __y)
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
+ hypot(_Tp __y, _Up __x)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
- return hypot(__type(__x), __type(__y));
+ return hypot(__type(__y), __type(__x));
}
inline int
{ return __builtin_ilogbl(__x); }
template<typename _Tp>
- inline int
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ int>::__type
ilogb(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return ilogb(__type(__x));
- }
+ { return __builtin_ilogb(__x); }
using std::ldexp;
{ return __builtin_lgammal(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
lgamma(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return lgamma(__type(__x));
- }
+ { return __builtin_lgamma(__x); }
inline long long
llrint(float __x)
{ return __builtin_llrintl(__x); }
template<typename _Tp>
- inline long long
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ long long>::__type
llrint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return llrint(__type(__x));
- }
+ { return __builtin_llrint(__x); }
inline long long
llround(float __x)
{ return __builtin_llroundl(__x); }
template<typename _Tp>
- inline long long
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ long long>::__type
llround(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return llround(__type(__x));
- }
+ { return __builtin_llround(__x); }
using std::log;
using std::log10;
{ return __builtin_log1pl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
log1p(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return log1p(__type(__x));
- }
+ { return __builtin_log1p(__x); }
// DR 568.
inline float
{ return __builtin_log2l(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
log2(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return log2(__type(__x));
- }
+ { return __builtin_log2(__x); }
inline float
logb(float __x)
{ return __builtin_logbl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
logb(_Tp __x)
{
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return logb(__type(__x));
+ return __builtin_logb(__x);
}
inline long
{ return __builtin_lrintl(__x); }
template<typename _Tp>
- inline long
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ long>::__type
lrint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return lrint(__type(__x));
- }
+ { return __builtin_lrint(__x); }
inline long
lround(float __x)
{ return __builtin_lroundl(__x); }
template<typename _Tp>
- inline long
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ long>::__type
lround(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return lround(__type(__x));
- }
+ { return __builtin_lround(__x); }
inline float
nearbyint(float __x)
{ return __builtin_nearbyintl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
nearbyint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return nearbyint(__type(__x));
- }
+ { return __builtin_nearbyint(__x); }
inline float
nextafter(float __x, float __y)
{ return __builtin_nextafterl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
nextafter(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_nexttowardl(__x, __y); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
nexttoward(_Tp __x, long double __y)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return nexttoward(__type(__x), __y);
- }
+ { return __builtin_nexttoward(__x, __y); }
// DR 550. What should the return type of pow(float,int) be?
// NB: C++0x and TR1 != C++03.
{ return __builtin_remainderl(__x, __y); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
remainder(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_remquol(__x, __y, __pquo); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
remquo(_Tp __x, _Up __y, int* __pquo)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
{ return __builtin_rintl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
rint(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return rint(__type(__x));
- }
+ { return __builtin_rint(__x); }
inline float
round(float __x)
{ return __builtin_roundl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
round(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return round(__type(__x));
- }
+ { return __builtin_round(__x); }
inline float
scalbln(float __x, long __ex)
{ return __builtin_scalblnl(__x, __ex); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
scalbln(_Tp __x, long __ex)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return scalbln(__type(__x), __ex);
- }
+ { return __builtin_scalbln(__x, __ex); }
inline float
scalbn(float __x, int __ex)
{ return __builtin_scalbnl(__x, __ex); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
scalbn(_Tp __x, int __ex)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return scalbn(__type(__x), __ex);
- }
+ { return __builtin_scalbn(__x, __ex); }
using std::sin;
using std::sinh;
{ return __builtin_tgammal(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
tgamma(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return tgamma(__type(__x));
- }
+ { return __builtin_tgamma(__x); }
inline float
trunc(float __x)
{ return __builtin_truncl(__x); }
template<typename _Tp>
- inline typename __gnu_cxx::__promote<_Tp>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
trunc(_Tp __x)
- {
- typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
- return trunc(__type(__x));
- }
+ { return __builtin_trunc(__x); }
#endif
_GLIBCXX_END_NAMESPACE_VERSION
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <cmath>
+
+// libstdc++/48933
+
+#ifdef _GLIBCXX_USE_C99_MATH_TR1
+
+struct Foo { };
+
+template Foo std::atan2<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::acosh<Foo>(Foo); // { dg-error "not match" }
+template Foo std::asinh<Foo>(Foo); // { dg-error "not match" }
+template Foo std::atanh<Foo>(Foo); // { dg-error "not match" }
+template Foo std::cbrt<Foo>(Foo); // { dg-error "not match" }
+template Foo std::copysign<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::erf<Foo>(Foo); // { dg-error "not match" }
+template Foo std::erfc<Foo>(Foo); // { dg-error "not match" }
+template Foo std::exp2<Foo>(Foo); // { dg-error "not match" }
+template Foo std::expm1<Foo>(Foo); // { dg-error "not match" }
+template Foo std::fdim<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::fma<Foo, Foo, Foo>(Foo(), Foo(), Foo()); // { dg-error "not match" }
+template Foo std::fmax<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::fmin<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::hypot<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template int std::ilogb<Foo>(Foo); // { dg-error "not match" }
+template Foo std::lgamma<Foo>(Foo); // { dg-error "not match" }
+template long long std::llrint<Foo>(Foo); // { dg-error "not match" }
+template long long std::llround<Foo>(Foo); // { dg-error "not match" }
+template Foo std::log1p<Foo>(Foo); // { dg-error "not match" }
+template Foo std::log2<Foo>(Foo); // { dg-error "not match" }
+template Foo std::logb<Foo>(Foo); // { dg-error "not match" }
+template long std::lrint<Foo>(Foo); // { dg-error "not match" }
+template long std::lround<Foo>(Foo); // { dg-error "not match" }
+template Foo std::nearbyint<Foo>(Foo); // { dg-error "not match" }
+template Foo std::nextafter<Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::nexttoward<Foo>(Foo, long double); // { dg-error "not match" }
+template Foo std::remainder<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::remquo<Foo>(Foo, Foo, int*); // { dg-error "not match" }
+template Foo std::rint<Foo>(Foo); // { dg-error "not match" }
+template Foo std::round<Foo>(Foo); // { dg-error "not match" }
+template Foo std::scalbln<Foo>(Foo, long); // { dg-error "not match" }
+template Foo std::scalbn<Foo>(Foo, int); // { dg-error "not match" }
+template Foo std::tgamma<Foo>(Foo); // { dg-error "not match" }
+template Foo std::trunc<Foo>(Foo); // { dg-error "not match" }
+
+#endif
--- /dev/null
+// { dg-do compile }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 8.16.4 Additional overloads
+
+#include <tr1/cmath>
+
+// libstdc++/48933
+
+#ifdef _GLIBCXX_USE_C99_MATH_TR1
+
+struct Foo { };
+
+template Foo std::tr1::atan2<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::tr1::acosh<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::asinh<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::atanh<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::cbrt<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::copysign<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::tr1::erf<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::erfc<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::exp2<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::expm1<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::fdim<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::tr1::fma<Foo, Foo, Foo>(Foo(), Foo(), Foo()); // { dg-error "not match" }
+template Foo std::tr1::fmax<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::tr1::fmin<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::tr1::hypot<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template int std::tr1::ilogb<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::lgamma<Foo>(Foo); // { dg-error "not match" }
+template long long std::tr1::llrint<Foo>(Foo); // { dg-error "not match" }
+template long long std::tr1::llround<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::log1p<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::log2<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::logb<Foo>(Foo); // { dg-error "not match" }
+template long std::tr1::lrint<Foo>(Foo); // { dg-error "not match" }
+template long std::tr1::lround<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::nearbyint<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::nextafter<Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::tr1::nexttoward<Foo>(Foo, long double); // { dg-error "not match" }
+template Foo std::tr1::remainder<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
+template Foo std::tr1::remquo<Foo>(Foo, Foo, int*); // { dg-error "not match" }
+template Foo std::tr1::rint<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::round<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::scalbln<Foo>(Foo, long); // { dg-error "not match" }
+template Foo std::tr1::scalbn<Foo>(Foo, int); // { dg-error "not match" }
+template Foo std::tr1::tgamma<Foo>(Foo); // { dg-error "not match" }
+template Foo std::tr1::trunc<Foo>(Foo); // { dg-error "not match" }
+
+#endif