diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2018-05-03 23:58:43 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-05-03 23:58:43 +0100 |
commit | 86f66562b73c61ae927b301d5dd907d7564c2e3f (patch) | |
tree | e3c52abc2451d4043866f85f82c0270c1e76bf2b /libstdc++-v3/include/tr1 | |
parent | 6c072e217f59a92136af99839ff7cab9065a4fa0 (diff) | |
download | gcc-86f66562b73c61ae927b301d5dd907d7564c2e3f.tar.gz |
PR libstdc++/82644 define TR1 hypergeometric functions in strict modes
Following a recent change for PR 82644 the non-standard hypergeomtric
functions are not defined by <cmath> when __STRICT_ANSI__ is defined
(e.g. for -std=c++17, or -std=c++14 -D__STDCPP_WANT_MATH_SPEC_FUNCS__).
That caused errors in <tr1/cmath> because the using-declarations for
tr1::hyperg et al are invalid in strict modes.
The solution is to define the TR1 hypergeometric functions inline in
<tr1/cmath> if __STRICT_ANSI__ is defined.
PR libstdc++/82644
* include/tr1/cmath [__STRICT_ANSI__] (hypergf, hypergl, hyperg): Use
inline definitions instead of using-declarations.
[__STRICT_ANSI__] (conf_hypergf, conf_hypergl, conf_hyperg): Likewise.
* testsuite/tr1/5_numerical_facilities/special_functions/
07_conf_hyperg/compile_cxx17.cc: New.
* testsuite/tr1/5_numerical_facilities/special_functions/
17_hyperg/compile_cxx17.cc: New.
From-SVN: r259912
Diffstat (limited to 'libstdc++-v3/include/tr1')
-rw-r--r-- | libstdc++-v3/include/tr1/cmath | 116 |
1 files changed, 73 insertions, 43 deletions
diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath index d1df3804120..c07dd5c73a5 100644 --- a/libstdc++-v3/include/tr1/cmath +++ b/libstdc++-v3/include/tr1/cmath @@ -1160,10 +1160,6 @@ namespace tr1 using std::comp_ellint_3l; using std::comp_ellint_3; - using __gnu_cxx::conf_hypergf; - using __gnu_cxx::conf_hypergl; - using __gnu_cxx::conf_hyperg; - using std::cyl_bessel_if; using std::cyl_bessel_il; using std::cyl_bessel_i; @@ -1200,10 +1196,6 @@ namespace tr1 using std::hermitel; using std::hermite; - using __gnu_cxx::hypergf; - using __gnu_cxx::hypergl; - using __gnu_cxx::hyperg; - using std::laguerref; using std::laguerrel; using std::laguerre; @@ -1246,7 +1238,6 @@ _GLIBCXX_END_NAMESPACE_VERSION #include <tr1/beta_function.tcc> #include <tr1/ell_integral.tcc> #include <tr1/exp_integral.tcc> -#include <tr1/hypergeometric.tcc> #include <tr1/legendre_function.tcc> #include <tr1/modified_bessel_func.tcc> #include <tr1/poly_hermite.tcc> @@ -1372,23 +1363,6 @@ namespace tr1 } inline float - conf_hypergf(float __a, float __c, float __x) - { return __detail::__conf_hyperg<float>(__a, __c, __x); } - - inline long double - conf_hypergl(long double __a, long double __c, long double __x) - { return __detail::__conf_hyperg<long double>(__a, __c, __x); } - - /// 5.2.1.7 Confluent hypergeometric functions. - template<typename _Tpa, typename _Tpc, typename _Tp> - inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type - conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x) - { - typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type; - return __detail::__conf_hyperg<__type>(__a, __c, __x); - } - - inline float cyl_bessel_if(float __nu, float __x) { return __detail::__cyl_bessel_i<float>(__nu, __x); } @@ -1542,23 +1516,6 @@ namespace tr1 } inline float - hypergf(float __a, float __b, float __c, float __x) - { return __detail::__hyperg<float>(__a, __b, __c, __x); } - - inline long double - hypergl(long double __a, long double __b, long double __c, long double __x) - { return __detail::__hyperg<long double>(__a, __b, __c, __x); } - - /// 5.2.1.17 Hypergeometric functions. - template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp> - inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type - hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x) - { - typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type; - return __detail::__hyperg<__type>(__a, __b, __c, __x); - } - - inline float laguerref(unsigned int __n, float __x) { return __detail::__laguerre<float>(__n, __x); } @@ -1668,4 +1625,77 @@ namespace tr1 _GLIBCXX_END_NAMESPACE_VERSION } // namespace std +#if _GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__) +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +namespace tr1 +{ + using __gnu_cxx::conf_hypergf; + using __gnu_cxx::conf_hypergl; + using __gnu_cxx::conf_hyperg; + + using __gnu_cxx::hypergf; + using __gnu_cxx::hypergl; + using __gnu_cxx::hyperg; +} // namespace tr1 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#else // ! (_GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__)) + +#include <bits/stl_algobase.h> +#include <limits> +#include <tr1/type_traits> + +#include <tr1/hypergeometric.tcc> + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +namespace tr1 +{ + inline float + conf_hypergf(float __a, float __c, float __x) + { return __detail::__conf_hyperg<float>(__a, __c, __x); } + + inline long double + conf_hypergl(long double __a, long double __c, long double __x) + { return __detail::__conf_hyperg<long double>(__a, __c, __x); } + + /// 5.2.1.7 Confluent hypergeometric functions. + template<typename _Tpa, typename _Tpc, typename _Tp> + inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type + conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x) + { + typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type; + return __detail::__conf_hyperg<__type>(__a, __c, __x); + } + + inline float + hypergf(float __a, float __b, float __c, float __x) + { return __detail::__hyperg<float>(__a, __b, __c, __x); } + + inline long double + hypergl(long double __a, long double __b, long double __c, long double __x) + { return __detail::__hyperg<long double>(__a, __b, __c, __x); } + + /// 5.2.1.17 Hypergeometric functions. + template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp> + inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type + hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x) + { + typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type; + return __detail::__hyperg<__type>(__a, __b, __c, __x); + } + +} // namespace tr1 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // _GLIBCXX_USE_STD_SPEC_FUNCS && !defined(__STRICT_ANSI__) + #endif // _GLIBCXX_TR1_CMATH |