+2004-06-22 Paolo Carlini <pcarlini@suse.de>
+
+ * testsuite/26_numerics/complex_inserters_extractors.cc,
+ complex_value.cc, buggy_complex.cc: Move to...
+ * testsuite/26_numerics/complex/: ... here.
+ * testsuite/26_numerics/c99_classification_macros_c++.cc,
+ c99_classification_macros_c.cc, c_math.cc, c_math_dynamic.cc,
+ fabs_inline.cc: Move to...
+ * testsuite/26_numerics/cmath/: ... here.
+ * testsuite/26_numerics/binary_closure.cc, slice.cc,
+ slice_array_assignment.cc, valarray.cc, valarray_const_bracket.cc,
+ valarray_name_lookup.cc, valarray_operators.cc,
+ valarray_subset_assignment.cc: Move to...
+ * testsuite/26_numerics/valarray/: ... here (new dir).
+ * testsuite/26_numerics/sum_diff.cc: Move to...
+ * testsuite/26_numerics/numeric/: ... here (new dir).
+
2004-06-22 Paolo Carlini <pcarlini@suse.de>
* include/std/std_istream.h (ignore(streamsize __n = 1,
+++ /dev/null
-// 19990805 gdr
-//
-// XXX: to impove later.
-// Origin: Andreas Amann <amann@physik.tu-berlin.de>
-// CXXFLAGS: -g
-
-#include <iostream>
-#include <valarray>
-
-
-int main()
-{
- std::valarray<double> a(10), b(10), c(10), d(10);
-
- a = 1.2;
- b = 3.1;
-
- c = 4.0;
-
- d = ( 2.0 * b + a ); // works
- std::cout << "d[4] = " << d[4] << std::endl;
-
- d = (a * 2.0 + b ); // works
- std::cout << "d[4] = " << d[4] << std::endl;
-
- d = (a + b * 2.0 ); // segfaults!
- std::cout << "d[4] = " << d[4] << std::endl;
- d = (a + 2.0* b );
-
- std::cout << "d[4] = " << d[4] << std::endl;
- d = (a + 2.0* b );
- std::cout << "d[4] = " << d[4] << std::endl;
- d = (a + 2.0* b );
-
- std::cout << "d[4] = " << d[4] << std::endl;
- return 0;
-}
+++ /dev/null
-// 2000-02-09
-// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
-
-// Copyright (C) 1999 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-
-// Test buggy builtin GNU __complex__ support. This used to cause
-// an ICE on some 64-bits plateforms.
-// Origin: petter@matfys.lth.se
-
-#include <complex>
-
-int main()
-{
- std::complex<double> a(9), b(0, 8), c;
-
- c = a * b;
-
- return 0;
-}
+++ /dev/null
-// 2001-04-06 gdr
-
-// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// { dg-do compile }
-
-#include <cmath>
-
-void fpclassify() { }
-
-void isfinite() { }
-
-void isinf() { }
-
-void isnan() { }
-
-void isnormal() { }
-
-void signbit() { }
-
-void isgreater() { }
-
-void isgreaterequal() { }
-
-void isless() { }
-
-void islessequal() { }
-
-void islessgreater() { }
-
-void isunordered() { }
-
-#if _GLIBCXX_USE_C99
-template <typename _Tp>
- void test_c99_classify()
- {
- bool test __attribute__((unused)) = true;
-
- typedef _Tp fp_type;
- fp_type f1 = 1.0;
- fp_type f2 = 3.0;
- int res = 0;
-
- res = std::fpclassify(f1);
- res = std::isfinite(f2);
- res = std::isinf(f1);
- res = std::isnan(f2);
- res = std::isnormal(f1);
- res = std::signbit(f2);
- res = std::isgreater(f1, f2);
- res = std::isgreaterequal(f1, f2);
- res = std::isless(f1, f2);
- res = std::islessequal(f1,f2);
- res = std::islessgreater(f1, f2);
- res = std::isunordered(f1, f2);
- }
-#endif
-
-int main()
-{
-#if _GLIBCXX_USE_C99
- test_c99_classify<float>();
- //test_c99_classify<double>();
-#endif
- return 0;
-}
+++ /dev/null
-// 2001-04-06 gdr
-
-// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// { dg-do compile { xfail *-*-linux-gnu *-*-freebsd5* } }
-// { dg-excess-errors "" { target *-*-linux-gnu *-*-freebsd5* } }
-
-#include <math.h>
-
-void fpclassify() { }
-
-void isfinite() { }
-
-void isinf() { }
-
-void isnan() { }
-
-void isnormal() { }
-
-void signbit() { }
-
-void isgreater() { }
-
-void isgreaterequal() { }
-
-void isless() { }
-
-void islessequal() { }
-
-void islessgreater() { }
-
-void isunordered() { }
-
+++ /dev/null
-// 1999-06-05
-// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
-
-// Copyright (C) 2000, 1999 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <cmath>
-#include <testsuite_hooks.h>
-
-// test compilation.
-int
-test01()
-{
- float a = 1.f;
- float b;
- std::modf(a, &b);
- return 0;
-}
-
-// need more extravagant checks than this, of course, but this used to core...
-int
-test02()
-{
- std::sin(static_cast<float>(0));
- return 0;
-}
-
-// as did this.
-int
-test03()
-{
- double powtest __attribute__((unused)) = std::pow(2., 0);
- return 0;
-}
-
-// this used to abort.
-int
-test04()
-{
- bool test __attribute__((unused)) = true;
- float x[2] = {1, 2};
- float y = 3.4;
- std::modf(y, &x[0]);
- VERIFY(x[1] == 2);
- return 0;
-}
-
-int
-main()
-{
- test01();
- test02();
- test03();
- test04();
- return 0;
-}
+++ /dev/null
-// Inspired by libstdc++/7680 & 26_numerics/c_math.cc, 2003-04-12 ljr
-
-// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// { dg-do link }
-// { dg-options "-D_XOPEN_SOURCE" { target *-*-freebsd* } }
-
-#include <cmath>
-
-int
-test01()
-{
- float a = 1.f;
- float b;
- std::modf(a, &b);
- return 0;
-}
-
-int
-test02 ()
-{
- float a = 0.0f;
- float b __attribute__((unused)) = std::acos(a);
- return 0;
-}
-
-int
-main()
-{
- test01();
- test02();
- return 0;
-}
--- /dev/null
+// 2001-04-06 gdr
+
+// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile }
+
+#include <cmath>
+
+void fpclassify() { }
+
+void isfinite() { }
+
+void isinf() { }
+
+void isnan() { }
+
+void isnormal() { }
+
+void signbit() { }
+
+void isgreater() { }
+
+void isgreaterequal() { }
+
+void isless() { }
+
+void islessequal() { }
+
+void islessgreater() { }
+
+void isunordered() { }
+
+#if _GLIBCXX_USE_C99
+template <typename _Tp>
+ void test_c99_classify()
+ {
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp fp_type;
+ fp_type f1 = 1.0;
+ fp_type f2 = 3.0;
+ int res = 0;
+
+ res = std::fpclassify(f1);
+ res = std::isfinite(f2);
+ res = std::isinf(f1);
+ res = std::isnan(f2);
+ res = std::isnormal(f1);
+ res = std::signbit(f2);
+ res = std::isgreater(f1, f2);
+ res = std::isgreaterequal(f1, f2);
+ res = std::isless(f1, f2);
+ res = std::islessequal(f1,f2);
+ res = std::islessgreater(f1, f2);
+ res = std::isunordered(f1, f2);
+ }
+#endif
+
+int main()
+{
+#if _GLIBCXX_USE_C99
+ test_c99_classify<float>();
+ //test_c99_classify<double>();
+#endif
+ return 0;
+}
--- /dev/null
+// 2001-04-06 gdr
+
+// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do compile { xfail *-*-linux-gnu *-*-freebsd5* } }
+// { dg-excess-errors "" { target *-*-linux-gnu *-*-freebsd5* } }
+
+#include <math.h>
+
+void fpclassify() { }
+
+void isfinite() { }
+
+void isinf() { }
+
+void isnan() { }
+
+void isnormal() { }
+
+void signbit() { }
+
+void isgreater() { }
+
+void isgreaterequal() { }
+
+void isless() { }
+
+void islessequal() { }
+
+void islessgreater() { }
+
+void isunordered() { }
+
--- /dev/null
+// 1999-06-05
+// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+// Copyright (C) 2000, 1999 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <cmath>
+#include <testsuite_hooks.h>
+
+// test compilation.
+int
+test01()
+{
+ float a = 1.f;
+ float b;
+ std::modf(a, &b);
+ return 0;
+}
+
+// need more extravagant checks than this, of course, but this used to core...
+int
+test02()
+{
+ std::sin(static_cast<float>(0));
+ return 0;
+}
+
+// as did this.
+int
+test03()
+{
+ double powtest __attribute__((unused)) = std::pow(2., 0);
+ return 0;
+}
+
+// this used to abort.
+int
+test04()
+{
+ bool test __attribute__((unused)) = true;
+ float x[2] = {1, 2};
+ float y = 3.4;
+ std::modf(y, &x[0]);
+ VERIFY(x[1] == 2);
+ return 0;
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ return 0;
+}
--- /dev/null
+// Inspired by libstdc++/7680 & 26_numerics/c_math.cc, 2003-04-12 ljr
+
+// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// { dg-do link }
+// { dg-options "-D_XOPEN_SOURCE" { target *-*-freebsd* } }
+
+#include <cmath>
+
+int
+test01()
+{
+ float a = 1.f;
+ float b;
+ std::modf(a, &b);
+ return 0;
+}
+
+int
+test02 ()
+{
+ float a = 0.0f;
+ float b __attribute__((unused)) = std::acos(a);
+ return 0;
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ return 0;
+}
--- /dev/null
+// Copyright (C) 1999, 2002 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// Test to see whether the host provides its own (inline) view of fabs.
+// Origin: Kurt Garloff <kurt@garloff.de>, 2001-05-24
+// dg-do link
+
+#include <cmath>
+#include <cstdio>
+
+typedef double (*realfn) (double);
+
+using std::fabs;
+
+int main ()
+{
+ double a = fabs (-2.4);
+ realfn myfn = fabs;
+ double b = myfn (-2.5);
+ std::printf ("%f, %f, %p\n", a, b, myfn);
+ return 0;
+}
--- /dev/null
+// 2000-02-09
+// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+// Copyright (C) 1999 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+
+// Test buggy builtin GNU __complex__ support. This used to cause
+// an ICE on some 64-bits plateforms.
+// Origin: petter@matfys.lth.se
+
+#include <complex>
+
+int main()
+{
+ std::complex<double> a(9), b(0, 8), c;
+
+ c = a * b;
+
+ return 0;
+}
--- /dev/null
+// 2000-02-10
+// Petter Urkedal <petter@matfys.lth.se>
+
+// Copyright (C) 2000, 2003 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <complex>
+#include <testsuite_hooks.h>
+#include <cmath>
+
+template<typename R>
+inline bool flteq(R x, R y)
+{
+ if (x == R(0)) return y == R(0);
+ else return std::fabs(x-y) < 1e-6*std::fabs(x);
+}
+
+template<typename R>
+int
+test_good(std::string str, R x, R y)
+{
+ bool test __attribute__((unused)) = true;
+ std::complex<R> z;
+ char ch;
+ std::istringstream iss(str);
+ iss >> z >> ch;
+ VERIFY( iss.good() );
+ VERIFY( flteq(z.real(), x) );
+ VERIFY( flteq(z.imag(), y) );
+ VERIFY( ch == '#' );
+ return 0;
+}
+
+template<typename R>
+int
+test_fail(std::string str)
+{
+ bool test __attribute__((unused)) = true;
+ std::complex<R> z;
+ std::istringstream iss(str);
+ iss >> z;
+ VERIFY( iss.fail() && !iss.bad() );
+ return 0;
+}
+
+template<typename R>
+int
+testall()
+{
+ test_good<R>("(-1.1,3.7)#", -1.1, 3.7);
+ test_good<R>("( .7e6 , \n-3.1)#", .7e6, -3.1);
+ test_good<R>("(\t0,-1)#", 0.0, -1.0);
+ test_good<R>("(-3.14)#", -3.14, 0.0);
+ test_good<R>("-.1#", -.1, 0.0);
+ test_good<R>(" ( -2.7e3 )#", -2.7e3, 0.0);
+ test_good<R>(" -.1#", -.1, 0.0);
+ test_fail<R>("(a,1)");
+ test_fail<R>("(,1)");
+ test_fail<R>("(1,a)");
+ test_fail<R>("(1, )");
+ test_fail<R>("|1,1)");
+ test_fail<R>("(1|1)");
+ test_fail<R>("(1,1|");
+ return 0;
+}
+
+// libstdc++/2970
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ complex<float> cf01(-1.1, -333.2);
+ stringstream ss;
+ ss << cf01;
+ string str = ss.str();
+ VERIFY( str == "(-1.1,-333.2)" );
+}
+
+// libstdc++/2985
+struct gnu_char_traits : public std::char_traits<char>
+{ };
+
+typedef std::basic_ostringstream<char, gnu_char_traits> gnu_sstream;
+template class std::basic_string<char, gnu_char_traits, std::allocator<char> >;
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ // Construct locale with specialized facets.
+ typedef gnu_sstream::__num_put_type numput_type;
+ typedef gnu_sstream::__num_get_type numget_type;
+ std::locale loc_c = std::locale::classic();
+ std::locale loc_1(loc_c, new numput_type);
+ std::locale loc_2(loc_1, new numget_type);
+ VERIFY( std::has_facet<numput_type>(loc_2) );
+ VERIFY( std::has_facet<numget_type>(loc_2) );
+
+ gnu_sstream sstr;
+ sstr.imbue(loc_2);
+
+
+ std::complex<double> x(3, 4);
+ sstr << x;
+ VERIFY( sstr.str() == "(3,4)" );
+}
+
+int
+main()
+{
+ testall<float>();
+ testall<double>();
+ testall<long double>();
+
+ test01();
+ test02();
+
+ return 0;
+}
+
+
+
+
--- /dev/null
+// { dg-options "-O0" }
+// 2000-11-20
+// Benjamin Kosnik bkoz@redhat.com
+
+// Copyright (C) 2000, 2003, 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <complex>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+ typedef complex<double> complex_type;
+ const double cd1 = -11.451;
+ const double cd2 = -442.1533;
+
+ complex_type a(cd1, cd2);
+ double d;
+ d = a.real();
+ VERIFY( d == cd1);
+
+ d = a.imag();
+ VERIFY(d == cd2);
+
+ complex_type c(cd1, cd2);
+ double d6 = abs(c);
+ VERIFY( d6 >= 0);
+
+ double d7 = arg(c);
+ double d8 = atan2(c.imag(), c.real());
+ VERIFY( d7 == d8);
+
+ double d9 = norm(c);
+ double d10 = d6 * d6;
+ VERIFY(d9 - d10 == 0);
+
+ complex_type e = conj(c);
+
+ complex_type f = polar(c.imag(), 0.0);
+ VERIFY(f.real() != 0);
+}
+
+
+int main()
+{
+ test01();
+ return 0;
+}
+++ /dev/null
-// 2000-02-10
-// Petter Urkedal <petter@matfys.lth.se>
-
-// Copyright (C) 2000, 2003 Free Software Foundation
-//
-// 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-
-#include <iostream>
-#include <string>
-#include <sstream>
-#include <complex>
-#include <testsuite_hooks.h>
-#include <cmath>
-
-template<typename R>
-inline bool flteq(R x, R y)
-{
- if (x == R(0)) return y == R(0);
- else return std::fabs(x-y) < 1e-6*std::fabs(x);
-}
-
-template<typename R>
-int
-test_good(std::string str, R x, R y)
-{
- bool test __attribute__((unused)) = true;
- std::complex<R> z;
- char ch;
- std::istringstream iss(str);
- iss >> z >> ch;
- VERIFY( iss.good() );
- VERIFY( flteq(z.real(), x) );
- VERIFY( flteq(z.imag(), y) );
- VERIFY( ch == '#' );
- return 0;
-}
-
-template<typename R>
-int
-test_fail(std::string str)
-{
- bool test __attribute__((unused)) = true;
- std::complex<R> z;
- std::istringstream iss(str);
- iss >> z;
- VERIFY( iss.fail() && !iss.bad() );
- return 0;
-}
-
-template<typename R>
-int
-testall()
-{
- test_good<R>("(-1.1,3.7)#", -1.1, 3.7);
- test_good<R>("( .7e6 , \n-3.1)#", .7e6, -3.1);
- test_good<R>("(\t0,-1)#", 0.0, -1.0);
- test_good<R>("(-3.14)#", -3.14, 0.0);
- test_good<R>("-.1#", -.1, 0.0);
- test_good<R>(" ( -2.7e3 )#", -2.7e3, 0.0);
- test_good<R>(" -.1#", -.1, 0.0);
- test_fail<R>("(a,1)");
- test_fail<R>("(,1)");
- test_fail<R>("(1,a)");
- test_fail<R>("(1, )");
- test_fail<R>("|1,1)");
- test_fail<R>("(1|1)");
- test_fail<R>("(1,1|");
- return 0;
-}
-
-// libstdc++/2970
-void test01()
-{
- using namespace std;
- bool test __attribute__((unused)) = true;
-
- complex<float> cf01(-1.1, -333.2);
- stringstream ss;
- ss << cf01;
- string str = ss.str();
- VERIFY( str == "(-1.1,-333.2)" );
-}
-
-// libstdc++/2985
-struct gnu_char_traits : public std::char_traits<char>
-{ };
-
-typedef std::basic_ostringstream<char, gnu_char_traits> gnu_sstream;
-template class std::basic_string<char, gnu_char_traits, std::allocator<char> >;
-
-void test02()
-{
- bool test __attribute__((unused)) = true;
-
- // Construct locale with specialized facets.
- typedef gnu_sstream::__num_put_type numput_type;
- typedef gnu_sstream::__num_get_type numget_type;
- std::locale loc_c = std::locale::classic();
- std::locale loc_1(loc_c, new numput_type);
- std::locale loc_2(loc_1, new numget_type);
- VERIFY( std::has_facet<numput_type>(loc_2) );
- VERIFY( std::has_facet<numget_type>(loc_2) );
-
- gnu_sstream sstr;
- sstr.imbue(loc_2);
-
-
- std::complex<double> x(3, 4);
- sstr << x;
- VERIFY( sstr.str() == "(3,4)" );
-}
-
-int
-main()
-{
- testall<float>();
- testall<double>();
- testall<long double>();
-
- test01();
- test02();
-
- return 0;
-}
-
-
-
-
+++ /dev/null
-// { dg-options "-O0" }
-// 2000-11-20
-// Benjamin Kosnik bkoz@redhat.com
-
-// Copyright (C) 2000, 2003, 2004 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <complex>
-#include <testsuite_hooks.h>
-
-void test01()
-{
- using namespace std;
- bool test __attribute__((unused)) = true;
- typedef complex<double> complex_type;
- const double cd1 = -11.451;
- const double cd2 = -442.1533;
-
- complex_type a(cd1, cd2);
- double d;
- d = a.real();
- VERIFY( d == cd1);
-
- d = a.imag();
- VERIFY(d == cd2);
-
- complex_type c(cd1, cd2);
- double d6 = abs(c);
- VERIFY( d6 >= 0);
-
- double d7 = arg(c);
- double d8 = atan2(c.imag(), c.real());
- VERIFY( d7 == d8);
-
- double d9 = norm(c);
- double d10 = d6 * d6;
- VERIFY(d9 - d10 == 0);
-
- complex_type e = conj(c);
-
- complex_type f = polar(c.imag(), 0.0);
- VERIFY(f.real() != 0);
-}
-
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// Copyright (C) 1999, 2002 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// Test to see whether the host provides its own (inline) view of fabs.
-// Origin: Kurt Garloff <kurt@garloff.de>, 2001-05-24
-// dg-do link
-
-#include <cmath>
-#include <cstdio>
-
-typedef double (*realfn) (double);
-
-using std::fabs;
-
-int main ()
-{
- double a = fabs (-2.4);
- realfn myfn = fabs;
- double b = myfn (-2.5);
- std::printf ("%f, %f, %p\n", a, b, myfn);
- return 0;
-}
--- /dev/null
+// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 26.4.3 [lib.partial.sum]
+// 26.4.4 [lib.adjacent.difference]
+
+#include <algorithm>
+#include <numeric>
+#include <cassert>
+
+int A[] = {1, 4, 9, 16, 25, 36, 49, 64, 81, 100};
+int B[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19};
+const int N = sizeof(A) / sizeof(int);
+
+void
+test01()
+{
+ int D[N];
+
+ std::adjacent_difference(A, A + N, D);
+ assert(std::equal(D, D + N, B));
+
+ std::partial_sum(D, D + N, D);
+ assert(std::equal(D, D + N, A));
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
+++ /dev/null
-// 20020717 gdr
-
-// Copyright (C) 2002, 2003 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// Test slice class invariants
-
-#include <valarray>
-#include <cstdlib>
-#include <testsuite_hooks.h>
-
-bool
-construction(std::size_t start, std::size_t size, std::size_t stride)
-{
- std::slice s(start, size, stride);
- return s.start() == start && s.size() == size && s.stride() == stride;
-}
-
-bool
-copy(std::size_t start, std::size_t size, std::size_t stride)
-{
- std::slice s(start, size, stride);
- std::slice t = s;
- return t.start() == start && t.size() == size && t.stride() == stride;
-}
-
-bool
-assignment(std::size_t start, std::size_t size, std::size_t stride)
-{
- std::slice s(start, size, stride);
- std::slice t;
- t = s;
- return t.start() == start && t.size() == size && t.stride() == stride;
-}
-
-
-int main()
-{
- bool test __attribute__((unused)) = true;
- std::srand(20020717);
- using std::rand;
- VERIFY(construction(rand(), rand(), rand()));
-
- VERIFY(copy(rand(), rand(), rand()));
-
- VERIFY(assignment(rand(), rand(), rand()));
-
- return 0;
-}
+++ /dev/null
-// 20010613 gdr
-
-// Copyright (C) 2001, 2002, 2003 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-
-// This is DR-253. Test for accessible assignment-operators.
-#include <valarray>
-#include <testsuite_hooks.h>
-
-int main()
-{
- bool test __attribute__((unused)) = true;
- using std::valarray;
- using std::slice;
- valarray<int> v(1, 10), w(2, 10);
-
- w[slice(0, 3, 3)] = v[slice(2, 3, 3)];
-
- VERIFY(v[0] == 1 && w[0] == 1);
- VERIFY(v[3] == 1 && w[3] == 1);
- VERIFY(v[6] == 1 && w[6] == 1);
-
- std::slice_array<int> t = v[slice(0, 10, 1)];
-
- return 0;
-}
+++ /dev/null
-// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// 26.4.3 [lib.partial.sum]
-// 26.4.4 [lib.adjacent.difference]
-
-#include <algorithm>
-#include <numeric>
-#include <cassert>
-
-int A[] = {1, 4, 9, 16, 25, 36, 49, 64, 81, 100};
-int B[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19};
-const int N = sizeof(A) / sizeof(int);
-
-void
-test01()
-{
- int D[N];
-
- std::adjacent_difference(A, A + N, D);
- assert(std::equal(D, D + N, B));
-
- std::partial_sum(D, D + N, D);
- assert(std::equal(D, D + N, A));
-}
-
-int
-main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 19990404 gdr
-
-// Copyright (C) 1999, 2000 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <valarray>
-
-int main()
-{
- // 01: instantiation
- std::valarray<double> a(20);
-
- // 02: algo
- using std::valarray;
- valarray<double> b, c;
- double m __attribute__((unused)) = std::abs(b - c).max();
-
- return 0;
-}
--- /dev/null
+// 19990805 gdr
+//
+// XXX: to impove later.
+// Origin: Andreas Amann <amann@physik.tu-berlin.de>
+// CXXFLAGS: -g
+
+#include <iostream>
+#include <valarray>
+
+
+int main()
+{
+ std::valarray<double> a(10), b(10), c(10), d(10);
+
+ a = 1.2;
+ b = 3.1;
+
+ c = 4.0;
+
+ d = ( 2.0 * b + a ); // works
+ std::cout << "d[4] = " << d[4] << std::endl;
+
+ d = (a * 2.0 + b ); // works
+ std::cout << "d[4] = " << d[4] << std::endl;
+
+ d = (a + b * 2.0 ); // segfaults!
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+ std::cout << "d[4] = " << d[4] << std::endl;
+ d = (a + 2.0* b );
+
+ std::cout << "d[4] = " << d[4] << std::endl;
+ return 0;
+}
--- /dev/null
+// 20020717 gdr
+
+// Copyright (C) 2002, 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// Test slice class invariants
+
+#include <valarray>
+#include <cstdlib>
+#include <testsuite_hooks.h>
+
+bool
+construction(std::size_t start, std::size_t size, std::size_t stride)
+{
+ std::slice s(start, size, stride);
+ return s.start() == start && s.size() == size && s.stride() == stride;
+}
+
+bool
+copy(std::size_t start, std::size_t size, std::size_t stride)
+{
+ std::slice s(start, size, stride);
+ std::slice t = s;
+ return t.start() == start && t.size() == size && t.stride() == stride;
+}
+
+bool
+assignment(std::size_t start, std::size_t size, std::size_t stride)
+{
+ std::slice s(start, size, stride);
+ std::slice t;
+ t = s;
+ return t.start() == start && t.size() == size && t.stride() == stride;
+}
+
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+ std::srand(20020717);
+ using std::rand;
+ VERIFY(construction(rand(), rand(), rand()));
+
+ VERIFY(copy(rand(), rand(), rand()));
+
+ VERIFY(assignment(rand(), rand(), rand()));
+
+ return 0;
+}
--- /dev/null
+// 20010613 gdr
+
+// Copyright (C) 2001, 2002, 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+// This is DR-253. Test for accessible assignment-operators.
+#include <valarray>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+ using std::valarray;
+ using std::slice;
+ valarray<int> v(1, 10), w(2, 10);
+
+ w[slice(0, 3, 3)] = v[slice(2, 3, 3)];
+
+ VERIFY(v[0] == 1 && w[0] == 1);
+ VERIFY(v[3] == 1 && w[3] == 1);
+ VERIFY(v[6] == 1 && w[6] == 1);
+
+ std::slice_array<int> t = v[slice(0, 10, 1)];
+
+ return 0;
+}
--- /dev/null
+// 19990404 gdr
+
+// Copyright (C) 1999, 2000 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <valarray>
+
+int main()
+{
+ // 01: instantiation
+ std::valarray<double> a(20);
+
+ // 02: algo
+ using std::valarray;
+ valarray<double> b, c;
+ double m __attribute__((unused)) = std::abs(b - c).max();
+
+ return 0;
+}
--- /dev/null
+// 20010518 gdr
+
+// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <valarray>
+
+// dg-do compile
+
+template<typename P>
+ void copy(P, std::size_t) { }
+
+template<typename T>
+ void test(const std::valarray<T>& v)
+ {
+ copy(&v[0], v.size());
+ }
+
+int main()
+{
+ std::valarray<double> v(190);
+ test(v);
+ return 0;
+}
--- /dev/null
+// 2002-08-02 gdr
+
+// Copyright (C) 2002, 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Test name lookup resolutions for standard functions applied to an
+// array expression.
+// { dg-do compile }
+
+#include <valarray>
+
+namespace My
+{
+ struct Number
+ {
+ operator bool() const;
+ };
+
+ Number operator+(Number);
+ Number operator-(Number);
+ Number operator~(Number);
+
+ bool operator!(Number);
+
+ Number operator+(Number, Number);
+ Number operator-(Number, Number);
+ Number operator*(Number, Number);
+ Number operator/(Number, Number);
+ Number operator%(Number, Number);
+
+ Number operator^(Number, Number);
+ Number operator&(Number, Number);
+ Number operator|(Number, Number);
+
+ Number operator<<(Number, Number);
+ Number operator>>(Number, Number);
+
+ bool operator==(Number, Number);
+ bool operator!=(Number, Number);
+ bool operator<(Number, Number);
+ bool operator<=(Number, Number);
+ bool operator>(Number, Number);
+ bool operator>=(Number, Number);
+
+ Number abs(Number);
+
+ Number cos(Number);
+ Number cosh(Number);
+ Number acos(Number);
+
+ Number sin(Number);
+ Number sinh(Number);
+ Number asin(Number);
+
+ Number tan(Number);
+ Number tanh(Number);
+ Number atan(Number);
+
+ Number exp(Number);
+ Number log(Number);
+ Number log10(Number);
+ Number sqrt(Number);
+
+ Number atan2(Number, Number);
+ Number pow(Number, Number);
+}
+
+int main()
+{
+ typedef std::valarray<My::Number> Array;
+ Array u(10), v(10);
+ v = +u;
+ v = -u;
+ v = ~u;
+ std::valarray<bool> z = !u;
+
+ v = abs(u);
+
+ v = cos(u);
+ v = cosh(u);
+ v = acos(u);
+
+ v = sin(u);
+ v = sinh(u);
+ v = asin(u);
+
+ v = tan(u);
+ v = tanh(u);
+ v = atan(u);
+
+ v = exp(u);
+ v = log(u);
+ v = log10(u);
+ v = sqrt(u);
+
+ Array w = u + v;
+ w = u - v;
+ w = u * v;
+ w = u / v;
+ w = u % v;
+
+ w = u ^ v;
+ w = u & v;
+ w = u | v;
+
+ w = u << v;
+ w = u >> v;
+
+ z = u == v;
+ z = u != v;
+ z = u < v;
+ z = u <= v;
+ z = u > v;
+ z = u >= v;
+
+ w = atan2(u, v);
+ w = pow(u, v);
+}
--- /dev/null
+// { dg-do run }
+// 2003-02-03 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+// Copyright (C) 2003 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <valarray>
+#include <testsuite_hooks.h>
+
+void test01() // check unary operators
+{
+ bool test __attribute__((unused)) = true;
+ std::valarray<int> u(1);
+ u[0]=1;
+
+ VERIFY( (+u)[0] == +1 );
+ VERIFY( (-u)[0] == -1 );
+ VERIFY( (!u)[0] == !1 );
+ VERIFY( (~u)[0] == ~1 );
+}
+
+void test02() // check binary operators
+{
+ bool test __attribute__((unused)) = true;
+ std::valarray<int> u(1), v(1);
+ u[0]=1;
+ v[0]=3;
+
+ VERIFY( (u+ v)[0] == (1+ 3) );
+ VERIFY( (u- v)[0] == (1- 3) );
+ VERIFY( (u* v)[0] == (1* 3) );
+ VERIFY( (u/ v)[0] == (1/ 3) );
+ VERIFY( (u% v)[0] == (1% 3) );
+ VERIFY( (u^ v)[0] == (1^ 3) );
+ VERIFY( (u& v)[0] == (1& 3) );
+ VERIFY( (u| v)[0] == (1| 3) );
+ VERIFY( (u<<v)[0] == (1<<3) );
+ VERIFY( (u>>v)[0] == (1>>3) );
+ VERIFY( (u&&v)[0] == (1&&3) );
+ VERIFY( (u||v)[0] == (1||3) );
+ VERIFY( (u==v)[0] == (1==3) );
+ VERIFY( (u!=v)[0] == (1!=3) );
+ VERIFY( (u< v)[0] == (1< 3) );
+ VERIFY( (u> v)[0] == (1> 3) );
+ VERIFY( (u<=v)[0] == (1<=3) );
+ VERIFY( (u>=v)[0] == (1>=3) );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
--- /dev/null
+// 2004-01-03 Jerry Quinn <jlquinn@optonline.net>
+
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// PR 3247
+
+// This is DR-253. Test for accessible assignment-operators.
+#include <valarray>
+#include <testsuite_hooks.h>
+
+bool check_array(std::valarray<double>& a, double b[])
+{
+ for (int i=0; i < a.size(); i++)
+ if (a[i] != b[i]) return false;
+ return true;
+}
+
+int main()
+{
+ double dvar = 1.0;
+ std::valarray<double> val_d(10); // 0 1 2 3 4 5 6 7 8 9
+ std::valarray<double> val_d1(10); // 10 9 8 7 6 5 4 3 2 1
+
+ for (int i=0; i< 10; i++) { val_d[i] = 10; val_d1[i] = i; }
+ std::valarray<double> val_c(val_d);
+ std::valarray<double> val_f(val_d);
+ std::valarray<double> val_g(val_d);
+
+ std::slice slc(1, 3, 3); // 1 4 7
+ val_d[slc] = val_d1[slc];
+
+ double ans1[10] = {10, 1, 10, 10, 4, 10, 10, 7, 10, 10};
+ VERIFY(check_array(val_d, ans1));
+
+ std::valarray<std::size_t> val_size(2);
+ std::valarray<std::size_t> val_stride(2);
+ val_size[0] = 2; val_size[1] = 3;
+ val_stride[0] = 4; val_stride[1] = 1;
+
+ std::gslice gslc(1, val_size, val_stride);
+ val_c[gslc] = val_d1[gslc];
+
+ double ans2[10] = {10, 1, 2, 3, 10, 5, 6, 7, 10, 10};
+ VERIFY(check_array(val_c, ans2));
+
+ std::valarray<bool> val_b(false, 10);
+ val_b[2] = val_b[6] = val_b[9] = true;
+ val_f[val_b] = val_d1[val_b];
+
+ double ans3[10] = {10, 10, 2, 10, 10, 10, 6, 10, 10, 9};
+ VERIFY(check_array(val_f, ans3));
+
+ size_t addr[] = {1, 2, 3, 4, 5};
+ size_t addr1[] = {2, 7, 1, 9, 4};
+ std::valarray<std::size_t> val_indirect(addr, 5);
+ std::valarray<std::size_t> val_indirect1(addr1, 5);
+ val_g[val_indirect] = val_d1[val_indirect1];
+
+ double ans4[10] = {10, 2, 7, 1, 9, 4, 10, 10, 10, 10};
+ VERIFY(check_array(val_g, ans4));
+
+ return 0;
+};
+++ /dev/null
-// 20010518 gdr
-
-// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <valarray>
-
-// dg-do compile
-
-template<typename P>
- void copy(P, std::size_t) { }
-
-template<typename T>
- void test(const std::valarray<T>& v)
- {
- copy(&v[0], v.size());
- }
-
-int main()
-{
- std::valarray<double> v(190);
- test(v);
- return 0;
-}
+++ /dev/null
-// 2002-08-02 gdr
-
-// Copyright (C) 2002, 2003 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Test name lookup resolutions for standard functions applied to an
-// array expression.
-// { dg-do compile }
-
-#include <valarray>
-
-namespace My
-{
- struct Number
- {
- operator bool() const;
- };
-
- Number operator+(Number);
- Number operator-(Number);
- Number operator~(Number);
-
- bool operator!(Number);
-
- Number operator+(Number, Number);
- Number operator-(Number, Number);
- Number operator*(Number, Number);
- Number operator/(Number, Number);
- Number operator%(Number, Number);
-
- Number operator^(Number, Number);
- Number operator&(Number, Number);
- Number operator|(Number, Number);
-
- Number operator<<(Number, Number);
- Number operator>>(Number, Number);
-
- bool operator==(Number, Number);
- bool operator!=(Number, Number);
- bool operator<(Number, Number);
- bool operator<=(Number, Number);
- bool operator>(Number, Number);
- bool operator>=(Number, Number);
-
- Number abs(Number);
-
- Number cos(Number);
- Number cosh(Number);
- Number acos(Number);
-
- Number sin(Number);
- Number sinh(Number);
- Number asin(Number);
-
- Number tan(Number);
- Number tanh(Number);
- Number atan(Number);
-
- Number exp(Number);
- Number log(Number);
- Number log10(Number);
- Number sqrt(Number);
-
- Number atan2(Number, Number);
- Number pow(Number, Number);
-}
-
-int main()
-{
- typedef std::valarray<My::Number> Array;
- Array u(10), v(10);
- v = +u;
- v = -u;
- v = ~u;
- std::valarray<bool> z = !u;
-
- v = abs(u);
-
- v = cos(u);
- v = cosh(u);
- v = acos(u);
-
- v = sin(u);
- v = sinh(u);
- v = asin(u);
-
- v = tan(u);
- v = tanh(u);
- v = atan(u);
-
- v = exp(u);
- v = log(u);
- v = log10(u);
- v = sqrt(u);
-
- Array w = u + v;
- w = u - v;
- w = u * v;
- w = u / v;
- w = u % v;
-
- w = u ^ v;
- w = u & v;
- w = u | v;
-
- w = u << v;
- w = u >> v;
-
- z = u == v;
- z = u != v;
- z = u < v;
- z = u <= v;
- z = u > v;
- z = u >= v;
-
- w = atan2(u, v);
- w = pow(u, v);
-}
+++ /dev/null
-// { dg-do run }
-// 2003-02-03 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
-
-// Copyright (C) 2003 Free Software Foundation
-//
-// 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <valarray>
-#include <testsuite_hooks.h>
-
-void test01() // check unary operators
-{
- bool test __attribute__((unused)) = true;
- std::valarray<int> u(1);
- u[0]=1;
-
- VERIFY( (+u)[0] == +1 );
- VERIFY( (-u)[0] == -1 );
- VERIFY( (!u)[0] == !1 );
- VERIFY( (~u)[0] == ~1 );
-}
-
-void test02() // check binary operators
-{
- bool test __attribute__((unused)) = true;
- std::valarray<int> u(1), v(1);
- u[0]=1;
- v[0]=3;
-
- VERIFY( (u+ v)[0] == (1+ 3) );
- VERIFY( (u- v)[0] == (1- 3) );
- VERIFY( (u* v)[0] == (1* 3) );
- VERIFY( (u/ v)[0] == (1/ 3) );
- VERIFY( (u% v)[0] == (1% 3) );
- VERIFY( (u^ v)[0] == (1^ 3) );
- VERIFY( (u& v)[0] == (1& 3) );
- VERIFY( (u| v)[0] == (1| 3) );
- VERIFY( (u<<v)[0] == (1<<3) );
- VERIFY( (u>>v)[0] == (1>>3) );
- VERIFY( (u&&v)[0] == (1&&3) );
- VERIFY( (u||v)[0] == (1||3) );
- VERIFY( (u==v)[0] == (1==3) );
- VERIFY( (u!=v)[0] == (1!=3) );
- VERIFY( (u< v)[0] == (1< 3) );
- VERIFY( (u> v)[0] == (1> 3) );
- VERIFY( (u<=v)[0] == (1<=3) );
- VERIFY( (u>=v)[0] == (1>=3) );
-}
-
-int main()
-{
- test01();
- test02();
- return 0;
-}
+++ /dev/null
-// 2004-01-03 Jerry Quinn <jlquinn@optonline.net>
-
-// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// PR 3247
-
-// This is DR-253. Test for accessible assignment-operators.
-#include <valarray>
-#include <testsuite_hooks.h>
-
-bool check_array(std::valarray<double>& a, double b[])
-{
- for (int i=0; i < a.size(); i++)
- if (a[i] != b[i]) return false;
- return true;
-}
-
-int main()
-{
- double dvar = 1.0;
- std::valarray<double> val_d(10); // 0 1 2 3 4 5 6 7 8 9
- std::valarray<double> val_d1(10); // 10 9 8 7 6 5 4 3 2 1
-
- for (int i=0; i< 10; i++) { val_d[i] = 10; val_d1[i] = i; }
- std::valarray<double> val_c(val_d);
- std::valarray<double> val_f(val_d);
- std::valarray<double> val_g(val_d);
-
- std::slice slc(1, 3, 3); // 1 4 7
- val_d[slc] = val_d1[slc];
-
- double ans1[10] = {10, 1, 10, 10, 4, 10, 10, 7, 10, 10};
- VERIFY(check_array(val_d, ans1));
-
- std::valarray<std::size_t> val_size(2);
- std::valarray<std::size_t> val_stride(2);
- val_size[0] = 2; val_size[1] = 3;
- val_stride[0] = 4; val_stride[1] = 1;
-
- std::gslice gslc(1, val_size, val_stride);
- val_c[gslc] = val_d1[gslc];
-
- double ans2[10] = {10, 1, 2, 3, 10, 5, 6, 7, 10, 10};
- VERIFY(check_array(val_c, ans2));
-
- std::valarray<bool> val_b(false, 10);
- val_b[2] = val_b[6] = val_b[9] = true;
- val_f[val_b] = val_d1[val_b];
-
- double ans3[10] = {10, 10, 2, 10, 10, 10, 6, 10, 10, 9};
- VERIFY(check_array(val_f, ans3));
-
- size_t addr[] = {1, 2, 3, 4, 5};
- size_t addr1[] = {2, 7, 1, 9, 4};
- std::valarray<std::size_t> val_indirect(addr, 5);
- std::valarray<std::size_t> val_indirect1(addr1, 5);
- val_g[val_indirect] = val_d1[val_indirect1];
-
- double ans4[10] = {10, 2, 7, 1, 9, 4, 10, 10, 10, 10};
- VERIFY(check_array(val_g, ans4));
-
- return 0;
-};