From f4a2cfed8aaf2ec1f07edda8396bfe2562a893c1 Mon Sep 17 00:00:00 2001 From: redi Date: Wed, 20 Jan 2016 17:44:58 +0000 Subject: [PATCH] Add C++11 overloads to the global namespace PR libstdc++/60401 * include/c_compatibility/math.h (acosh, asinh, atanh, acbrt, copysign, erf, erfc, exp2, expm1, fdim, fma, fmax, fmin, hypot, ilogb, lgamma, llrint, llround, log1p, log2, logb, lrint, lround, nearbyint, nextafter, nexttoward, remainder, remquo, rint, round, scalbln, scalbn, tgamma, trunc) [__cplusplus >= 201103L && _GLIBCXX_USE_C99_MATH_TR1]: Add using declarations. * testsuite/26_numerics/headers/cmath/60401.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232627 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 +++ libstdc++-v3/include/c_compatibility/math.h | 37 ++++++++++++ .../testsuite/26_numerics/headers/cmath/60401.cc | 68 ++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/60401.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b78a2f74836..577490b6e8a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,14 @@ 2016-01-20 Jonathan Wakely + PR libstdc++/60401 + * include/c_compatibility/math.h (acosh, asinh, atanh, acbrt, + copysign, erf, erfc, exp2, expm1, fdim, fma, fmax, fmin, hypot, ilogb, + lgamma, llrint, llround, log1p, log2, logb, lrint, lround, nearbyint, + nextafter, nexttoward, remainder, remquo, rint, round, scalbln, scalbn, + tgamma, trunc) [__cplusplus >= 201103L && _GLIBCXX_USE_C99_MATH_TR1]: + Add using declarations. + * testsuite/26_numerics/headers/cmath/60401.cc: New. + PR libstdc++/69386 * include/c_global/ccomplex: Ensure C++ language linkage. * include/c_global/cmath: Likewise. diff --git a/libstdc++-v3/include/c_compatibility/math.h b/libstdc++-v3/include/c_compatibility/math.h index 67f5ef1afa1..d1fe75d78c6 100644 --- a/libstdc++-v3/include/c_compatibility/math.h +++ b/libstdc++-v3/include/c_compatibility/math.h @@ -74,5 +74,42 @@ using std::islessgreater; using std::isunordered; #endif +#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_MATH_TR1) +using std::acosh; +using std::asinh; +using std::atanh; +using std::cbrt; +using std::copysign; +using std::erf; +using std::erfc; +using std::exp2; +using std::expm1; +using std::fdim; +using std::fma; +using std::fmax; +using std::fmin; +using std::hypot; +using std::ilogb; +using std::lgamma; +using std::llrint; +using std::llround; +using std::log1p; +using std::log2; +using std::logb; +using std::lrint; +using std::lround; +using std::nearbyint; +using std::nextafter; +using std::nexttoward; +using std::remainder; +using std::remquo; +using std::rint; +using std::round; +using std::scalbln; +using std::scalbn; +using std::tgamma; +using std::trunc; +#endif // C++11 && _GLIBCXX_USE_C99_MATH_TR1 + #endif #endif diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/60401.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/60401.cc new file mode 100644 index 00000000000..a6be94aa3df --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/60401.cc @@ -0,0 +1,68 @@ +// Copyright (C) 2016 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 +// . + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// PR libstdc++/60401 + +#include + +namespace test +{ + template + using F = T*; + + Fabs = ::abs; + +#ifdef _GLIBCXX_USE_C99_MATH_TR1 + F acosh = ::acosh; + F asinh = ::asinh; + F atanh = ::atanh; + F cbrt = ::cbrt; + F copysign = ::copysign; + F erf = ::erf; + F erfc = ::erfc; + F exp2 = ::exp2; + F expm1 = ::expm1; + F fdim = ::fdim; + F fma = ::fma; + F fmax = ::fmax; + F fmin = ::fmin; + F hypot = ::hypot; + F ilogb = ::ilogb; + F lgamma = ::lgamma; + F llrint = ::llrint; + F llround = ::llround; + F log1p = ::log1p; + F log2 = ::log2; + F logb = ::logb; + F lrint = ::lrint; + F lround = ::lround; + F nearbyint = ::nearbyint; + F nextafter = ::nextafter; + F nexttoward = ::nexttoward; + F remainder = ::remainder; + F remquo = ::remquo; + F rint = ::rint; + F round = ::round; + F scalbln = ::scalbln; + F scalbn = ::scalbn; + F tgamma = ::tgamma; + F trunc = ::trunc; +#endif +} -- 2.11.4.GIT