summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/tr1/8_c_compatibility
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/tr1/8_c_compatibility')
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc35
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc34
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc61
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc33
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/51083.cc62
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc193
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc257
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc64
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc34
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/50880.cc51
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/51083.cc54
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc48
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc102
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc98
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc57
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc73
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc37
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc90
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/cwctype/functions.cc40
21 files changed, 1527 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc
new file mode 100644
index 000000000..862b0419f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc
@@ -0,0 +1,35 @@
+// { dg-do compile }
+
+// 2006-01-25 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009, 2010 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.4 Additions to header <cctype>
+
+#include <tr1/cctype>
+
+void test01()
+{
+#if _GLIBCXX_USE_C99_CTYPE_TR1
+
+ int ch = 0, ret;
+ ret = std::tr1::isblank(ch);
+ ret = ret; // Suppress unused warning.
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc
new file mode 100644
index 000000000..5bffa0ef3
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc
@@ -0,0 +1,52 @@
+// { dg-do compile }
+
+// 2006-01-26 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009, 2010 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.6 Header <cfenv>
+
+#include <tr1/cfenv>
+
+void test01()
+{
+#if _GLIBCXX_USE_C99_FENV_TR1
+
+ int except = 0, mode = 0;
+ std::tr1::fexcept_t* pflag = 0;
+ std::tr1::fenv_t* penv = 0;
+
+ int ret;
+
+ ret = std::tr1::feclearexcept(except);
+ ret = std::tr1::fegetexceptflag(pflag, except);
+ ret = std::tr1::feraiseexcept(except);
+ ret = std::tr1::fesetexceptflag(pflag, except);
+ ret = std::tr1::fetestexcept(except);
+
+ ret = std::tr1::fegetround();
+ ret = std::tr1::fesetround(mode);
+
+ ret = std::tr1::fegetenv(penv);
+ ret = std::tr1::feholdexcept(penv);
+ ret = std::tr1::fesetenv(penv);
+ ret = std::tr1::feupdateenv(penv);
+ ret = ret; // Suppress unused warning.
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc
new file mode 100644
index 000000000..f16ccdad3
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types_std_tr1.cc
@@ -0,0 +1,34 @@
+// { dg-do compile }
+
+// 2006-01-26 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 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.6 Header <cfenv>
+
+#include <tr1/cfenv>
+
+void test01()
+{
+#if _GLIBCXX_USE_C99_FENV_TR1
+
+ typedef std::tr1::fenv_t my_fenv_t;
+ typedef std::tr1::fexcept_t my_fexcept_t;
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
new file mode 100644
index 000000000..30c7b789f
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
@@ -0,0 +1,61 @@
+// { dg-do compile }
+
+// 2006-01-30 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 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.11 Header <cinttypes>
+
+#include <tr1/cinttypes>
+
+void test01()
+{
+#if _GLIBCXX_USE_C99_INTTYPES_TR1
+
+ std::tr1::intmax_t i = 0, numer = 0, denom = 0, base = 0;
+ const char* s = 0;
+ char** endptr = 0;
+#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
+ const wchar_t* ws = 0;
+ wchar_t** wendptr = 0;
+#endif
+
+ std::tr1::intmax_t ret;
+ std::tr1::uintmax_t uret;
+ std::tr1::imaxdiv_t dret;
+
+ ret = std::tr1::imaxabs(i);
+ // ret = std::tr1::abs(i);
+
+ dret = std::tr1::imaxdiv(numer, denom);
+ // dret = std::tr1::div(numer, denom);
+
+ ret = std::tr1::strtoimax(s, endptr, base);
+ uret = std::tr1::strtoumax(s, endptr, base);
+
+#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
+ ret = std::tr1::wcstoimax(ws, wendptr, base);
+ uret = std::tr1::wcstoumax(ws, wendptr, base);
+#endif
+
+ ret = ret; // Suppress unused warnings.
+ dret = dret;
+ uret = uret;
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc
new file mode 100644
index 000000000..1bd230a4d
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cinttypes/types_std_tr1.cc
@@ -0,0 +1,33 @@
+// { dg-do compile }
+
+// 2006-01-30 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 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.11 Header <cinttypes>
+
+#include <tr1/cinttypes>
+
+void test01()
+{
+#if _GLIBCXX_USE_C99_INTTYPES_TR1
+
+ typedef std::tr1::imaxdiv_t my_imaxdiv_t;
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/51083.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/51083.cc
new file mode 100644
index 000000000..504305a30
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/51083.cc
@@ -0,0 +1,62 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <tr1/cmath>
+
+namespace a
+{
+ template<typename> class Mat { };
+
+ template<typename T> struct Mat2 : Mat<T> { };
+
+ template<typename T>
+ int fdim(Mat<T>) { return 1; }
+
+ template<typename T, typename U>
+ int floor(Mat<T>, U) { return 1; }
+ template<typename T, typename U>
+ int floor(T, Mat<U>) { return 1; }
+
+ template<typename T, typename U, typename V>
+ int fma(Mat<T>, U, V) { return 1; }
+ template<typename T, typename U, typename V>
+ int fma(T, Mat<U>, V) { return 1; }
+ template<typename T, typename U, typename V>
+ int fma(T, U, Mat<V>) { return 1; }
+}
+
+int main()
+{
+ int __attribute__((unused)) i;
+
+ using namespace std::tr1;
+
+ a::Mat2<double> c;
+ i = fdim(c);
+ i = floor(c, 0.);
+ i = floor(0., c);
+ i = floor(c, 1);
+ i = floor(1, c);
+ i = fma(c, 0., 1.);
+ i = fma(0., c, 1.);
+ i = fma(0., 1., c);
+ i = fma(c, 0., 1);
+ i = fma(0., c, 1);
+ i = fma(0., 1, c);
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc
new file mode 100644
index 000000000..ae31a48ec
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc
@@ -0,0 +1,193 @@
+// { dg-do compile }
+
+// 2006-02-07 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 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 Additions to header <cmath>
+
+#include <tr1/cmath>
+
+void test01()
+{
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+ double d0 = 0.0;
+ float f0 = 0.0f;
+ long double ld0 = 0.0l;
+ const char* str = "NAN";
+ int* pquo = 0;
+ long lex = 0l;
+ int ex = 0;
+
+ double ret;
+ float fret;
+ long double ldret;
+ int iret;
+ long lret;
+ long long llret;
+
+ ret = std::tr1::acosh(d0);
+ fret = std::tr1::acoshf(f0);
+ ldret = std::tr1::acoshl(ld0);
+
+ ret = std::tr1::asinh(d0);
+ fret = std::tr1::asinhf(f0);
+ ldret = std::tr1::asinhl(ld0);
+
+ ret = std::tr1::atanh(d0);
+ fret = std::tr1::atanhf(f0);
+ ldret = std::tr1::atanhl(ld0);
+
+ ret = std::tr1::cbrt(d0);
+ fret = std::tr1::cbrtf(f0);
+ ldret = std::tr1::cbrtl(ld0);
+
+ ret = std::tr1::copysign(d0, d0);
+ fret = std::tr1::copysignf(f0, f0);
+ ldret = std::tr1::copysignl(ld0, ld0);
+
+ ret = std::tr1::erf(d0);
+ fret = std::tr1::erff(f0);
+ ldret = std::tr1::erfl(ld0);
+
+ ret = std::tr1::erfc(d0);
+ fret = std::tr1::erfcf(f0);
+ ldret = std::tr1::erfcl(ld0);
+
+ ret = std::tr1::exp2(d0);
+ fret = std::tr1::exp2f(f0);
+ ldret = std::tr1::exp2l(ld0);
+
+ ret = std::tr1::expm1(d0);
+ fret = std::tr1::expm1f(f0);
+ ldret = std::tr1::expm1l(ld0);
+
+ ret = std::tr1::fdim(d0, d0);
+ fret = std::tr1::fdimf(f0, f0);
+ ldret = std::tr1::fdiml(ld0, ld0);
+
+ ret = std::tr1::fma(d0, d0, d0);
+ fret = std::tr1::fmaf(f0, f0, f0);
+ ldret = std::tr1::fmal(ld0, ld0, ld0);
+
+ ret = std::tr1::fmax(d0, d0);
+ fret = std::tr1::fmaxf(f0, f0);
+ ldret = std::tr1::fmaxl(ld0, ld0);
+
+ ret = std::tr1::fmin(d0, d0);
+ fret = std::tr1::fminf(f0, f0);
+ ldret = std::tr1::fminl(ld0, ld0);
+
+ ret = std::tr1::hypot(d0, d0);
+ fret = std::tr1::hypotf(f0, f0);
+ ldret = std::tr1::hypotl(ld0, ld0);
+
+ iret = std::tr1::ilogb(d0);
+ iret = std::tr1::ilogbf(f0);
+ iret = std::tr1::ilogbl(ld0);
+
+ ret = std::tr1::lgamma(d0);
+ fret = std::tr1::lgammaf(f0);
+ ldret = std::tr1::lgammal(ld0);
+
+ llret = std::tr1::llrint(d0);
+ llret = std::tr1::llrintf(f0);
+ llret = std::tr1::llrintl(ld0);
+
+ llret = std::tr1::llround(d0);
+ llret = std::tr1::llroundf(f0);
+ llret = std::tr1::llroundl(ld0);
+
+ ret = std::tr1::log1p(d0);
+ fret = std::tr1::log1pf(f0);
+ ldret = std::tr1::log1pl(ld0);
+
+ ret = std::tr1::log2(d0);
+ fret = std::tr1::log2f(f0);
+ ldret = std::tr1::log2l(ld0);
+
+ ret = std::tr1::logb(d0);
+ fret = std::tr1::logbf(f0);
+ ldret = std::tr1::logbl(ld0);
+
+ lret = std::tr1::lrint(d0);
+ lret = std::tr1::lrintf(f0);
+ lret = std::tr1::lrintl(ld0);
+
+ lret = std::tr1::lround(d0);
+ lret = std::tr1::lroundf(f0);
+ lret = std::tr1::lroundl(ld0);
+
+ ret = std::tr1::nan(str);
+ fret = std::tr1::nanf(str);
+ ldret = std::tr1::nanl(str);
+
+ ret = std::tr1::nearbyint(d0);
+ fret = std::tr1::nearbyintf(f0);
+ ldret = std::tr1::nearbyintl(ld0);
+
+ ret = std::tr1::nextafter(d0, d0);
+ fret = std::tr1::nextafterf(f0, f0);
+ ldret = std::tr1::nextafterl(ld0, ld0);
+
+ ret = std::tr1::nexttoward(d0, ld0);
+ fret = std::tr1::nexttowardf(f0, ld0);
+ ldret = std::tr1::nexttowardl(ld0, ld0);
+
+ ret = std::tr1::remainder(d0, d0);
+ fret = std::tr1::remainderf(f0, f0);
+ ldret = std::tr1::remainderl(ld0, ld0);
+
+ ret = std::tr1::remquo(d0, d0, pquo);
+ fret = std::tr1::remquof(f0, f0, pquo);
+ ldret = std::tr1::remquol(ld0, ld0, pquo);
+
+ ret = std::tr1::rint(d0);
+ fret = std::tr1::rintf(f0);
+ ldret = std::tr1::rintl(ld0);
+
+ ret = std::tr1::round(d0);
+ fret = std::tr1::roundf(f0);
+ ldret = std::tr1::roundl(ld0);
+
+ ret = std::tr1::scalbln(d0, lex);
+ fret = std::tr1::scalblnf(f0, lex);
+ ldret = std::tr1::scalblnl(ld0, lex);
+
+ ret = std::tr1::scalbn(d0, ex);
+ fret = std::tr1::scalbnf(f0, ex);
+ ldret = std::tr1::scalbnl(ld0, ex);
+
+ ret = std::tr1::tgamma(d0);
+ fret = std::tr1::tgammaf(f0);
+ ldret = std::tr1::tgammal(ld0);
+
+ ret = std::tr1::trunc(d0);
+ fret = std::tr1::truncf(f0);
+ ldret = std::tr1::truncl(ld0);
+
+ ret = ret; // Suppress unused warnings.
+ iret = iret;
+ lret = lret;
+ llret = llret;
+ fret = fret;
+ ldret = ldret;
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc
new file mode 100644
index 000000000..04bc91275
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc
@@ -0,0 +1,257 @@
+// { dg-do compile }
+
+// 2006-03-07 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 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>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+ using namespace __gnu_test;
+
+ double d0 = 0.0;
+ float f0 = 0.0f;
+ long double ld0 = 0.0l;
+ int i0 = 0;
+ int* pquo = 0;
+ long lex = 0l;
+ int ex = 0;
+
+ check_ret_type<double>(std::tr1::atan2(d0, d0));
+ check_ret_type<double>(std::tr1::atan2(d0, f0));
+ check_ret_type<float>(std::tr1::atan2(f0, f0));
+ check_ret_type<long double>(std::tr1::atan2(ld0, ld0));
+ check_ret_type<long double>(std::tr1::atan2(ld0, d0));
+ check_ret_type<double>(std::tr1::atan2(i0, i0));
+ check_ret_type<double>(std::tr1::atan2(d0, i0));
+
+ check_ret_type<double>(std::tr1::acosh(d0));
+ check_ret_type<float>(std::tr1::acosh(f0));
+ check_ret_type<long double>(std::tr1::acosh(ld0));
+ check_ret_type<double>(std::tr1::acosh(i0));
+
+ check_ret_type<double>(std::tr1::asinh(d0));
+ check_ret_type<float>(std::tr1::asinh(f0));
+ check_ret_type<long double>(std::tr1::asinh(ld0));
+ check_ret_type<double>(std::tr1::asinh(i0));
+
+ check_ret_type<double>(std::tr1::atanh(d0));
+ check_ret_type<float>(std::tr1::atanh(f0));
+ check_ret_type<long double>(std::tr1::atanh(ld0));
+ check_ret_type<double>(std::tr1::atanh(i0));
+
+ check_ret_type<double>(std::tr1::cbrt(d0));
+ check_ret_type<float>(std::tr1::cbrt(f0));
+ check_ret_type<long double>(std::tr1::cbrt(ld0));
+ check_ret_type<double>(std::tr1::cbrt(i0));
+
+ check_ret_type<double>(std::tr1::copysign(d0, d0));
+ check_ret_type<double>(std::tr1::copysign(d0, f0));
+ check_ret_type<float>(std::tr1::copysign(f0, f0));
+ check_ret_type<long double>(std::tr1::copysign(ld0, ld0));
+ check_ret_type<long double>(std::tr1::copysign(ld0, d0));
+ check_ret_type<double>(std::tr1::copysign(i0, i0));
+ check_ret_type<double>(std::tr1::copysign(d0, i0));
+
+ check_ret_type<double>(std::tr1::erf(d0));
+ check_ret_type<float>(std::tr1::erf(f0));
+ check_ret_type<long double>(std::tr1::erf(ld0));
+ check_ret_type<double>(std::tr1::erf(i0));
+
+ check_ret_type<double>(std::tr1::erfc(d0));
+ check_ret_type<float>(std::tr1::erfc(f0));
+ check_ret_type<long double>(std::tr1::erfc(ld0));
+ check_ret_type<double>(std::tr1::erfc(i0));
+
+ check_ret_type<double>(std::tr1::exp2(d0));
+ check_ret_type<float>(std::tr1::exp2(f0));
+ check_ret_type<long double>(std::tr1::exp2(ld0));
+ check_ret_type<double>(std::tr1::exp2(i0));
+
+ check_ret_type<double>(std::tr1::expm1(d0));
+ check_ret_type<float>(std::tr1::expm1(f0));
+ check_ret_type<long double>(std::tr1::expm1(ld0));
+ check_ret_type<double>(std::tr1::expm1(i0));
+
+ check_ret_type<double>(std::tr1::fdim(d0, d0));
+ check_ret_type<double>(std::tr1::fdim(d0, f0));
+ check_ret_type<float>(std::tr1::fdim(f0, f0));
+ check_ret_type<long double>(std::tr1::fdim(ld0, ld0));
+ check_ret_type<long double>(std::tr1::fdim(ld0, d0));
+ check_ret_type<double>(std::tr1::fdim(i0, i0));
+ check_ret_type<double>(std::tr1::fdim(d0, i0));
+
+ check_ret_type<double>(std::tr1::fma(d0, d0, d0));
+ check_ret_type<double>(std::tr1::fma(d0, f0, d0));
+ check_ret_type<float>(std::tr1::fma(f0, f0, f0));
+ check_ret_type<long double>(std::tr1::fma(ld0, ld0, ld0));
+ check_ret_type<long double>(std::tr1::fma(ld0, d0, f0));
+ check_ret_type<double>(std::tr1::fma(i0, i0, i0));
+ check_ret_type<double>(std::tr1::fma(d0, i0, f0));
+
+ check_ret_type<double>(std::tr1::fmax(d0, d0));
+ check_ret_type<double>(std::tr1::fmax(d0, f0));
+ check_ret_type<float>(std::tr1::fmax(f0, f0));
+ check_ret_type<long double>(std::tr1::fmax(ld0, ld0));
+ check_ret_type<long double>(std::tr1::fmax(ld0, d0));
+ check_ret_type<double>(std::tr1::fmax(i0, i0));
+ check_ret_type<double>(std::tr1::fmax(d0, i0));
+
+ check_ret_type<double>(std::tr1::fmin(d0, d0));
+ check_ret_type<double>(std::tr1::fmin(d0, f0));
+ check_ret_type<float>(std::tr1::fmin(f0, f0));
+ check_ret_type<long double>(std::tr1::fmin(ld0, ld0));
+ check_ret_type<long double>(std::tr1::fmin(ld0, d0));
+ check_ret_type<double>(std::tr1::fmin(i0, i0));
+ check_ret_type<double>(std::tr1::fmin(d0, i0));
+
+ check_ret_type<double>(std::tr1::hypot(d0, d0));
+ check_ret_type<double>(std::tr1::hypot(d0, f0));
+ check_ret_type<float>(std::tr1::hypot(f0, f0));
+ check_ret_type<long double>(std::tr1::hypot(ld0, ld0));
+ check_ret_type<long double>(std::tr1::hypot(ld0, d0));
+ check_ret_type<double>(std::tr1::hypot(i0, i0));
+ check_ret_type<double>(std::tr1::hypot(d0, i0));
+
+ check_ret_type<int>(std::tr1::ilogb(d0));
+ check_ret_type<int>(std::tr1::ilogb(f0));
+ check_ret_type<int>(std::tr1::ilogb(ld0));
+ check_ret_type<int>(std::tr1::ilogb(i0));
+
+ check_ret_type<double>(std::tr1::lgamma(d0));
+ check_ret_type<float>(std::tr1::lgamma(f0));
+ check_ret_type<long double>(std::tr1::lgamma(ld0));
+ check_ret_type<double>(std::tr1::lgamma(i0));
+
+ check_ret_type<long long>(std::tr1::llrint(d0));
+ check_ret_type<long long>(std::tr1::llrint(f0));
+ check_ret_type<long long>(std::tr1::llrint(ld0));
+ check_ret_type<long long>(std::tr1::llrint(i0));
+
+ check_ret_type<long long>(std::tr1::llround(d0));
+ check_ret_type<long long>(std::tr1::llround(f0));
+ check_ret_type<long long>(std::tr1::llround(ld0));
+ check_ret_type<long long>(std::tr1::llround(i0));
+
+ check_ret_type<double>(std::tr1::log1p(d0));
+ check_ret_type<float>(std::tr1::log1p(f0));
+ check_ret_type<long double>(std::tr1::log1p(ld0));
+ check_ret_type<double>(std::tr1::log1p(i0));
+
+ // DR 568.
+ check_ret_type<double>(std::tr1::log2(d0));
+ check_ret_type<float>(std::tr1::log2(f0));
+ check_ret_type<long double>(std::tr1::log2(ld0));
+ check_ret_type<double>(std::tr1::log2(i0));
+
+ check_ret_type<double>(std::tr1::logb(d0));
+ check_ret_type<float>(std::tr1::logb(f0));
+ check_ret_type<long double>(std::tr1::logb(ld0));
+ check_ret_type<double>(std::tr1::logb(i0));
+
+ check_ret_type<long>(std::tr1::lrint(d0));
+ check_ret_type<long>(std::tr1::lrint(f0));
+ check_ret_type<long>(std::tr1::lrint(ld0));
+ check_ret_type<long>(std::tr1::lrint(i0));
+
+ check_ret_type<long>(std::tr1::lround(d0));
+ check_ret_type<long>(std::tr1::lround(f0));
+ check_ret_type<long>(std::tr1::lround(ld0));
+ check_ret_type<long>(std::tr1::lround(i0));
+
+ check_ret_type<double>(std::tr1::nearbyint(d0));
+ check_ret_type<float>(std::tr1::nearbyint(f0));
+ check_ret_type<long double>(std::tr1::nearbyint(ld0));
+ check_ret_type<double>(std::tr1::nearbyint(i0));
+
+ check_ret_type<double>(std::tr1::nextafter(d0, d0));
+ check_ret_type<double>(std::tr1::nextafter(d0, f0));
+ check_ret_type<float>(std::tr1::nextafter(f0, f0));
+ check_ret_type<long double>(std::tr1::nextafter(ld0, ld0));
+ check_ret_type<long double>(std::tr1::nextafter(ld0, d0));
+ check_ret_type<double>(std::tr1::nextafter(i0, i0));
+ check_ret_type<double>(std::tr1::nextafter(d0, i0));
+
+ check_ret_type<double>(std::tr1::nexttoward(d0, ld0));
+ check_ret_type<float>(std::tr1::nexttoward(f0, ld0));
+ check_ret_type<long double>(std::tr1::nexttoward(ld0, ld0));
+ check_ret_type<double>(std::tr1::nexttoward(i0, ld0));
+
+ check_ret_type<double>(std::tr1::pow(d0, d0));
+ check_ret_type<double>(std::tr1::pow(d0, f0));
+ check_ret_type<float>(std::tr1::pow(f0, f0));
+ check_ret_type<long double>(std::tr1::pow(ld0, ld0));
+ check_ret_type<long double>(std::tr1::pow(ld0, d0));
+ check_ret_type<double>(std::tr1::pow(i0, i0));
+ check_ret_type<double>(std::tr1::pow(d0, i0));
+ check_ret_type<double>(std::tr1::pow(f0, i0));
+
+ check_ret_type<double>(std::tr1::remainder(d0, d0));
+ check_ret_type<double>(std::tr1::remainder(d0, f0));
+ check_ret_type<float>(std::tr1::remainder(f0, f0));
+ check_ret_type<long double>(std::tr1::remainder(ld0, ld0));
+ check_ret_type<long double>(std::tr1::remainder(ld0, d0));
+ check_ret_type<double>(std::tr1::remainder(i0, i0));
+ check_ret_type<double>(std::tr1::remainder(d0, i0));
+
+ check_ret_type<double>(std::tr1::remquo(d0, d0, pquo));
+ check_ret_type<double>(std::tr1::remquo(d0, f0, pquo));
+ check_ret_type<float>(std::tr1::remquo(f0, f0, pquo));
+ check_ret_type<long double>(std::tr1::remquo(ld0, ld0, pquo));
+ check_ret_type<long double>(std::tr1::remquo(ld0, d0, pquo));
+ check_ret_type<double>(std::tr1::remquo(i0, i0, pquo));
+ check_ret_type<double>(std::tr1::remquo(d0, i0, pquo));
+
+ check_ret_type<double>(std::tr1::rint(d0));
+ check_ret_type<float>(std::tr1::rint(f0));
+ check_ret_type<long double>(std::tr1::rint(ld0));
+ check_ret_type<double>(std::tr1::rint(i0));
+
+ check_ret_type<double>(std::tr1::round(d0));
+ check_ret_type<float>(std::tr1::round(f0));
+ check_ret_type<long double>(std::tr1::round(ld0));
+ check_ret_type<double>(std::tr1::round(i0));
+
+ check_ret_type<double>(std::tr1::scalbln(d0, lex));
+ check_ret_type<float>(std::tr1::scalbln(f0, lex));
+ check_ret_type<long double>(std::tr1::scalbln(ld0, lex));
+ check_ret_type<double>(std::tr1::scalbln(i0, lex));
+
+ check_ret_type<double>(std::tr1::scalbn(d0, ex));
+ check_ret_type<float>(std::tr1::scalbn(f0, ex));
+ check_ret_type<long double>(std::tr1::scalbn(ld0, ex));
+ check_ret_type<double>(std::tr1::scalbn(i0, ex));
+
+ check_ret_type<double>(std::tr1::tgamma(d0));
+ check_ret_type<float>(std::tr1::tgamma(f0));
+ check_ret_type<long double>(std::tr1::tgamma(ld0));
+ check_ret_type<double>(std::tr1::tgamma(i0));
+
+ check_ret_type<double>(std::tr1::trunc(d0));
+ check_ret_type<float>(std::tr1::trunc(f0));
+ check_ret_type<long double>(std::tr1::trunc(ld0));
+ check_ret_type<double>(std::tr1::trunc(i0));
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc
new file mode 100644
index 000000000..cbf8c9592
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc
@@ -0,0 +1,64 @@
+// { dg-do compile }
+
+// 2006-02-26 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009, 2010 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 Additions to header <cmath>
+
+#include <tr1/cmath>
+
+#if _GLIBCXX_USE_C99
+#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
+
+template<typename T>
+ void test01_do()
+ {
+ T x = T();
+
+ bool ret;
+ int iret;
+
+ ret = std::tr1::signbit(x);
+
+ iret = std::tr1::fpclassify(x);
+ iret = iret; // Suppress unused warning.
+
+ ret = std::tr1::isfinite(x);
+ ret = std::tr1::isinf(x);
+ ret = std::tr1::isnan(x);
+ ret = std::tr1::isnormal(x);
+
+ ret = std::tr1::isgreater(x, x);
+ ret = std::tr1::isgreaterequal(x, x);
+ ret = std::tr1::isless(x, x);
+ ret = std::tr1::islessequal(x, x);
+ ret = std::tr1::islessgreater(x, x);
+ ret = std::tr1::isunordered(x, x);
+ ret = ret; // Suppress unused warning.
+ }
+
+void test01()
+{
+ test01_do<float>();
+ test01_do<double>();
+ test01_do<long double>();
+}
+
+#endif
+#endif
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc
new file mode 100644
index 000000000..8786c8eff
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types_std_tr1.cc
@@ -0,0 +1,34 @@
+// { dg-do compile }
+
+// 2006-03-10 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 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 Additions to header <cmath>
+
+#include <tr1/cmath>
+
+void test01()
+{
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+ typedef std::tr1::double_t my_double_t;
+ typedef std::tr1::float_t my_float_t;
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/50880.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/50880.cc
new file mode 100644
index 000000000..eaa2f3d81
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/50880.cc
@@ -0,0 +1,51 @@
+// 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 <tr1/complex>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ void test01_do()
+ {
+ bool test __attribute__((unused)) = true;
+
+ const std::complex<T> ca(T(-2), T(2));
+ const std::complex<T> cb(T(-2), T(0));
+ const std::complex<T> cc(T(-2), T(-2));
+
+ std::complex<T> cra = std::tr1::acosh(ca);
+ std::complex<T> crb = std::tr1::acosh(cb);
+ std::complex<T> crc = std::tr1::acosh(cc);
+
+ VERIFY( cra.real() > T(0) );
+ VERIFY( crb.real() > T(0) );
+ VERIFY( crc.real() > T(0) );
+ }
+
+// libstdc++/50880
+void test01()
+{
+ test01_do<float>();
+ test01_do<double>();
+ test01_do<long double>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/51083.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/51083.cc
new file mode 100644
index 000000000..f41914ee9
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/51083.cc
@@ -0,0 +1,54 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <tr1/complex>
+
+namespace a
+{
+ template<typename> class Mat { };
+
+ template<typename T> struct Mat2 : Mat<T> { };
+
+ template<typename T> int arg(Mat<T>) { return 1; }
+ template<typename T> int conj(Mat<T>) { return 1; }
+ template<typename T> int imag(Mat<T>) { return 1; }
+ template<typename T> int norm(Mat<T>) { return 1; }
+ template<typename T> int proj(Mat<T>) { return 1; }
+ template<typename T> int real(Mat<T>) { return 1; }
+
+ template<typename T, typename U> int pow(Mat<T>, U) { return 1; }
+ template<typename T, typename U> int pow(T, Mat<U>) { return 1; }
+}
+
+int main()
+{
+ int __attribute__((unused)) i;
+
+ using namespace std::tr1;
+
+ a::Mat2< std::complex<double> > c;
+ i = arg(c);
+ i = conj(c);
+ i = imag(c);
+ i = norm(c);
+ i = proj(c);
+ i = real(c);
+ i = pow(std::complex<float>(), c);
+ i = pow(c, std::complex<float>());
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc
new file mode 100644
index 000000000..3560d4fd4
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc
@@ -0,0 +1,48 @@
+// { dg-do compile }
+
+// 2006-01-10 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 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.1 Additions to header <complex>
+
+#include <tr1/complex>
+
+template<typename T>
+ void test01_do()
+ {
+ typedef std::complex<T> cmplx_type;
+
+ cmplx_type ans;
+
+ ans = std::tr1::acos(cmplx_type(1.0, 1.0));
+ ans = std::tr1::asin(cmplx_type(1.0, 1.0));
+ ans = std::tr1::atan(cmplx_type(1.0, 1.0));
+
+ ans = std::tr1::acosh(cmplx_type(1.0, 1.0));
+ ans = std::tr1::asinh(cmplx_type(1.0, 1.0));
+ ans = std::tr1::atanh(cmplx_type(1.0, 1.0));
+ ans = std::tr1::fabs(cmplx_type(1.0, 1.0));
+ }
+
+void test01()
+{
+ test01_do<float>();
+ test01_do<double>();
+ test01_do<long double>();
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc
new file mode 100644
index 000000000..1e12cdba2
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc
@@ -0,0 +1,102 @@
+// { dg-do compile }
+
+// 2006-01-12 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 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.1 Additions to header <complex>
+
+#include <tr1/complex>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+ using __gnu_test::check_ret_type;
+
+ typedef std::complex<float> cmplx_f_type;
+ typedef std::complex<double> cmplx_d_type;
+ typedef std::complex<long double> cmplx_ld_type;
+
+ const float f1 = 1.0f;
+ const double d1 = 1.0;
+ const long double ld1 = 1.0l;
+
+ const cmplx_f_type c_f1(f1, f1);
+ const cmplx_d_type c_d1(d1, d1);
+ const cmplx_ld_type c_ld1(ld1, ld1);
+
+ check_ret_type<float>(std::tr1::arg(f1));
+ check_ret_type<double>(std::tr1::arg(d1));
+ check_ret_type<long double>(std::tr1::arg(ld1));
+
+ check_ret_type<cmplx_f_type>(std::tr1::conj(f1));
+ check_ret_type<cmplx_d_type>(std::tr1::conj(d1));
+ check_ret_type<cmplx_ld_type>(std::tr1::conj(ld1));
+
+ check_ret_type<float>(std::tr1::imag(f1));
+ check_ret_type<double>(std::tr1::imag(d1));
+ check_ret_type<long double>(std::tr1::imag(ld1));
+
+ check_ret_type<float>(std::tr1::norm(f1));
+ check_ret_type<double>(std::tr1::norm(d1));
+ check_ret_type<long double>(std::tr1::norm(ld1));
+
+ check_ret_type<cmplx_f_type>(std::tr1::polar(f1, f1));
+ check_ret_type<cmplx_d_type>(std::tr1::polar(d1, f1));
+ check_ret_type<cmplx_d_type>(std::tr1::polar(f1, d1));
+ check_ret_type<cmplx_d_type>(std::tr1::polar(d1, d1));
+ check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, d1));
+ check_ret_type<cmplx_ld_type>(std::tr1::polar(d1, ld1));
+ check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, f1));
+ check_ret_type<cmplx_ld_type>(std::tr1::polar(f1, ld1));
+ check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, ld1));
+
+ check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, f1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, f1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, d1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, d1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, d1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, ld1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, f1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, ld1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, ld1));
+
+ check_ret_type<cmplx_f_type>(std::tr1::pow(f1, c_f1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_f1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(f1, c_d1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_d1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_d1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(d1, c_ld1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_f1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(f1, c_ld1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_ld1));
+
+ check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, c_f1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_f1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, c_d1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_d1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_d1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, c_ld1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_f1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, c_ld1));
+ check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_ld1));
+
+ check_ret_type<float>(std::tr1::real(f1));
+ check_ret_type<double>(std::tr1::real(d1));
+ check_ret_type<long double>(std::tr1::real(ld1));
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc
new file mode 100644
index 000000000..a8a9bfba3
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc
@@ -0,0 +1,98 @@
+// 2006-01-12 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2007, 2008, 2009 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.1 Additions to header <complex>
+
+#include <tr1/complex>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::check_ret_type;
+
+ typedef std::complex<float> cmplx_f_type;
+ typedef std::complex<double> cmplx_d_type;
+
+ const int i1 = 1;
+ const unsigned u1 = 1;
+ const long l1 = 1;
+ const double f1 = 1.0f;
+ const double d1 = 1.0;
+
+ check_ret_type<double>(std::tr1::arg(i1));
+ VERIFY( std::tr1::arg(i1) == std::tr1::arg(double(i1)) );
+ VERIFY( std::tr1::arg(i1) == std::tr1::arg(cmplx_d_type(double(i1))) );
+
+ check_ret_type<cmplx_d_type>(std::tr1::conj(i1));
+ VERIFY( std::tr1::conj(i1) == std::tr1::conj(double(i1)) );
+ VERIFY( std::tr1::conj(i1) == std::tr1::conj(cmplx_d_type(double(i1))) );
+
+ check_ret_type<double>(std::tr1::imag(i1));
+ VERIFY( std::tr1::imag(i1) == std::tr1::imag(double(i1)) );
+ VERIFY( std::tr1::imag(i1) == std::tr1::imag(cmplx_d_type(double(i1))) );
+
+ check_ret_type<double>(std::tr1::norm(i1));
+ VERIFY( std::tr1::norm(i1) == std::tr1::norm(double(i1)) );
+ // std::norm<const complex<>&) is mathematically equivalent to just
+ // this for a real, but the general algorithm goes through std::abs
+ // and a multiplication.
+ VERIFY( std::tr1::norm(i1) == double(i1) * double(i1) );
+
+ // NB: The existing std::polar wins and a cmplx_i_type is returned.
+ // check_ret_type<cmplx_d_type>(std::tr1::polar(i1, i1));
+ // VERIFY( std::tr1::polar(i1, i1)
+ // == std::tr1::polar(double(i1), double(i1)) );
+ typedef std::complex<int> cmplx_i_type;
+ check_ret_type<cmplx_i_type>(std::tr1::polar(i1, i1));
+
+ check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), i1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), u1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), l1));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_d_type(d1, d1), i1));
+
+ VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), i1)
+ == std::tr1::pow(cmplx_d_type(d1, d1), double(i1)) );
+ VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), u1)
+ == std::tr1::pow(cmplx_d_type(d1, d1), double(u1)) );
+ VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), l1)
+ == std::tr1::pow(cmplx_d_type(d1, d1), double(l1)) );
+
+ check_ret_type<cmplx_d_type>(std::tr1::pow(i1, cmplx_f_type(f1, f1)));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(u1, cmplx_f_type(f1, f1)));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(l1, cmplx_f_type(f1, f1)));
+ check_ret_type<cmplx_d_type>(std::tr1::pow(i1, cmplx_d_type(d1, d1)));
+ VERIFY( std::tr1::pow(i1, cmplx_d_type(d1, d1))
+ == std::tr1::pow(double(i1), cmplx_d_type(d1, d1)) );
+ VERIFY( std::tr1::pow(u1, cmplx_d_type(d1, d1))
+ == std::tr1::pow(double(u1), cmplx_d_type(d1, d1)) );
+ VERIFY( std::tr1::pow(l1, cmplx_d_type(d1, d1))
+ == std::tr1::pow(double(l1), cmplx_d_type(d1, d1)) );
+
+ check_ret_type<double>(std::tr1::real(i1));
+ VERIFY( std::tr1::real(i1) == std::tr1::real(double(i1)) );
+ VERIFY( std::tr1::real(i1) == std::tr1::real(cmplx_d_type(double(i1))) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc
new file mode 100644
index 000000000..34cd791bc
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types_std_tr1.cc
@@ -0,0 +1,57 @@
+// { dg-do compile }
+// { dg-require-cstdint "" }
+
+// 2006-01-29 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2007, 2008, 2009 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.22 Header <cstdint>
+
+#include <tr1/cstdint>
+
+void test01()
+{
+ typedef std::tr1::int8_t my_int8_t;
+ typedef std::tr1::int16_t my_int16_t;
+ typedef std::tr1::int32_t my_int32_t;
+ typedef std::tr1::int64_t my_int64_t;
+ typedef std::tr1::int_fast8_t my_int_fast8_t;
+ typedef std::tr1::int_fast16_t my_int_fast16_t;
+ typedef std::tr1::int_fast32_t my_int_fast32_t;
+ typedef std::tr1::int_fast64_t my_int_fast64_t;
+ typedef std::tr1::int_least8_t my_int_least8_t;
+ typedef std::tr1::int_least16_t my_int_least16_t;
+ typedef std::tr1::int_least32_t my_int_least32_t;
+ typedef std::tr1::int_least64_t my_int_least64_t;
+ typedef std::tr1::intmax_t my_intmax_t;
+ typedef std::tr1::intptr_t my_intptr_t;
+ typedef std::tr1::uint8_t my_uint8_t;
+ typedef std::tr1::uint16_t my_uint16_t;
+ typedef std::tr1::uint32_t my_uint32_t;
+ typedef std::tr1::uint64_t my_uint64_t;
+ typedef std::tr1::uint_fast8_t my_uint_fast8_t;
+ typedef std::tr1::uint_fast16_t my_uint_fast16_t;
+ typedef std::tr1::uint_fast32_t my_uint_fast32_t;
+ typedef std::tr1::uint_fast64_t my_uint_fast64_t;
+ typedef std::tr1::uint_least8_t my_uint_least8_t;
+ typedef std::tr1::uint_least16_t my_uint_least16_t;
+ typedef std::tr1::uint_least32_t my_uint_least32_t;
+ typedef std::tr1::uint_least64_t my_uint_least64_t;
+ typedef std::tr1::uintmax_t my_uintmax_t;
+ typedef std::tr1::uintptr_t my_uintptr_t;
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc
new file mode 100644
index 000000000..338902522
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc
@@ -0,0 +1,52 @@
+// { dg-do compile }
+
+// 2006-02-05 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009, 2010 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.24 Additions to header <cstdio>
+
+#include <tr1/cstdio>
+#include <cstdarg>
+#include <cstddef>
+
+void test01(int dummy, ...)
+{
+ std::va_list ap;
+ va_start(ap, dummy);
+
+#if _GLIBCXX_USE_C99
+
+ char* s = 0;
+ const char* cs = 0;
+ const char* format = "%i";
+ FILE* stream = 0;
+ std::size_t n = 0;
+
+ int ret;
+
+ ret = std::tr1::snprintf(s, n, format, dummy);
+ ret = std::tr1::vsnprintf(s, n, format, ap);
+
+ ret = std::tr1::vfscanf(stream, format, ap);
+ ret = std::tr1::vscanf(format, ap);
+ ret = std::tr1::vsscanf(cs, format, ap);
+ ret = ret; // Suppress unused warning.
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc
new file mode 100644
index 000000000..f9b88dca9
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc
@@ -0,0 +1,73 @@
+// { dg-do compile }
+
+// 2006-02-07 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009, 2010 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.25 Additions to header <cstdlib>
+
+#include <tr1/cstdlib>
+
+#if _GLIBCXX_HOSTED
+
+void test01()
+{
+#if _GLIBCXX_USE_C99
+
+ long long i = 0;
+ const char* s = 0;
+ char** endptr = 0;
+ int base = 0;
+
+ long long ret;
+ unsigned long long uret;
+ float fret;
+ long double ldret;
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ long long numer = 0, denom = 0;
+ std::tr1::lldiv_t dret;
+
+ ret = std::tr1::llabs(i);
+ dret = std::tr1::lldiv(numer, denom);
+#endif
+
+ ret = std::tr1::atoll(s);
+ ret = std::tr1::strtoll(s, endptr, base);
+ uret = std::tr1::strtoull(s, endptr, base);
+
+ fret = std::tr1::strtof(s, endptr);
+ ldret = std::tr1::strtold(s, endptr);
+
+ ret = std::tr1::abs(i);
+
+ ret = ret; // Suppress unused warning.
+ uret = uret;
+ fret = fret;
+ ldret = ldret;
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ dret = std::tr1::div(numer, denom);
+
+ dret = dret;
+#endif
+
+#endif
+}
+
+#endif
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc
new file mode 100644
index 000000000..cb00cf4b8
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+
+// 2006-02-07 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009 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.25 Additions to header <cstdlib>
+
+#include <tr1/cstdlib>
+
+#if _GLIBCXX_HOSTED
+
+void test01()
+{
+#if _GLIBCXX_USE_C99
+
+ typedef std::tr1::lldiv_t my_lldiv_t;
+
+#endif
+}
+
+#endif
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc
new file mode 100644
index 000000000..0320c9a5a
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc
@@ -0,0 +1,90 @@
+// { dg-do compile }
+
+// 2006-02-03 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009, 2010 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.6 Additions to header <cwchar>
+
+#include <tr1/cwchar>
+#include <cstdio>
+#include <cstdarg>
+
+#if _GLIBCXX_USE_WCHAR_T
+
+void test01(int dummy, ...)
+{
+ std::va_list arg;
+ va_start(arg, dummy);
+
+#if _GLIBCXX_HAVE_WCSTOF
+ const wchar_t* nptr1 = 0;
+ wchar_t** endptr1 = 0;
+ float fret;
+ fret = std::tr1::wcstof(nptr1, endptr1);
+
+ fret = fret; // Suppress unused warning.
+#endif
+
+#if _GLIBCXX_HAVE_VFWSCANF
+ FILE* stream = 0;
+ const wchar_t* format1 = 0;
+ int ret1;
+ ret1 = std::tr1::vfwscanf(stream, format1, arg);
+
+ ret1 = ret1; // Suppress unused warning.
+#endif
+
+#if _GLIBCXX_HAVE_VSWSCANF
+ const wchar_t* s = 0;
+ const wchar_t* format2 = 0;
+ int ret2;
+ ret2 = std::tr1::vswscanf(s, format2, arg);
+
+ ret2 = ret2; // Suppress unused warning.
+#endif
+
+#if _GLIBCXX_HAVE_VWSCANF
+ const wchar_t* format3 = 0;
+ int ret3;
+ ret3 = std::tr1::vwscanf(format3, arg);
+
+ ret3 = ret3; // Suppress unused warning.
+#endif
+
+#if _GLIBCXX_USE_C99
+
+ const wchar_t* nptr2 = 0;
+ wchar_t** endptr2 = 0;
+ long double ldret;
+ ldret = std::tr1::wcstold(nptr2, endptr2);
+
+ int base = 0;
+ long long llret;
+ unsigned long long ullret;
+ llret = std::tr1::wcstoll(nptr2, endptr2, base);
+ ullret = std::tr1::wcstoull(nptr2, endptr2, base);
+
+ ldret = ldret; // Suppress unused warnings.
+ llret = llret;
+ ullret = ullret;
+
+#endif
+}
+
+#endif
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwctype/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwctype/functions.cc
new file mode 100644
index 000000000..031b3ac16
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwctype/functions.cc
@@ -0,0 +1,40 @@
+// { dg-do compile }
+
+// 2006-02-03 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006, 2009, 2010 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.32 Additions to header <cwctype>
+
+#include <tr1/cwctype>
+
+#if _GLIBCXX_USE_WCHAR_T
+
+void test01()
+{
+#if _GLIBCXX_HAVE_ISWBLANK
+
+ std::wint_t ch = 0;
+ int ret;
+ ret = std::tr1::iswblank(ch);
+ ret = ret; // Suppress unused warning.
+
+#endif
+}
+
+#endif