aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2011-05-09 15:38:21 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2011-05-09 15:38:21 +0000
commitb04fa7381131433b4019acea6b8e95aadd60aec4 (patch)
tree20e5b92b56d2f0953650bff5a899f3322af42ab5 /libstdc++-v3
parenta9e6994ab9f27c07d9345b6e5cbeb3ed2cf21625 (diff)
downloadgcc-b04fa7381131433b4019acea6b8e95aadd60aec4.zip
gcc-b04fa7381131433b4019acea6b8e95aadd60aec4.tar.gz
gcc-b04fa7381131433b4019acea6b8e95aadd60aec4.tar.bz2
re PR libstdc++/48933 (Infinite recursion in tr1/cmath functions with complex parameters)
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. From-SVN: r173574
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog12
-rw-r--r--libstdc++-v3/include/c_global/cmath259
-rw-r--r--libstdc++-v3/include/tr1/cmath257
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads_c++0x_neg.cc65
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads_neg.cc66
5 files changed, 389 insertions, 270 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index af2f9b9..0ba7118 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,15 @@
+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.
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index a333eb5..e38ab9d 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -1,7 +1,7 @@
// -*- 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
@@ -1120,12 +1120,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1136,12 +1134,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1152,12 +1148,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1168,12 +1162,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1184,7 +1176,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -1200,12 +1196,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1216,12 +1210,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1232,12 +1224,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1248,12 +1238,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1264,7 +1252,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -1280,7 +1272,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -1296,7 +1293,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -1312,7 +1313,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -1328,8 +1333,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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));
@@ -1344,12 +1353,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1360,12 +1367,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1376,12 +1381,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1392,12 +1395,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1408,12 +1409,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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
@@ -1425,12 +1424,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1441,12 +1438,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1457,12 +1452,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1473,12 +1466,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1489,12 +1480,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1505,7 +1494,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -1521,12 +1514,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1537,7 +1528,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -1553,7 +1548,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -1569,12 +1568,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1585,12 +1582,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1601,12 +1596,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1617,12 +1610,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1633,12 +1624,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1649,12 +1638,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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
diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath
index 21bdee8..9ada637 100644
--- a/libstdc++-v3/include/tr1/cmath
+++ b/libstdc++-v3/include/tr1/cmath
@@ -429,12 +429,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -447,12 +445,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -466,12 +462,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -482,12 +476,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -500,7 +492,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -519,12 +515,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -535,12 +529,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -553,12 +545,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -569,12 +559,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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
@@ -604,7 +592,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -622,7 +614,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -638,7 +635,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -654,7 +655,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -673,11 +678,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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
@@ -689,12 +698,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -707,12 +714,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -723,12 +728,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -739,12 +742,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -758,12 +759,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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
@@ -775,12 +774,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -791,11 +788,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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
@@ -807,12 +804,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -823,12 +818,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -839,12 +832,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -855,7 +846,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -871,12 +866,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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.
@@ -891,7 +884,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -907,7 +904,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -923,12 +924,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -939,12 +938,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -955,12 +952,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -971,12 +966,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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;
@@ -993,12 +986,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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)
@@ -1009,12 +1000,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads_c++0x_neg.cc
new file mode 100644
index 0000000..2d8862e
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads_c++0x_neg.cc
@@ -0,0 +1,65 @@
+// { 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
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads_neg.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads_neg.cc
new file mode 100644
index 0000000..174a81d
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads_neg.cc
@@ -0,0 +1,66 @@
+// { 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