Update copyright in libstdc++-v3.
[official-gcc.git] / libstdc++-v3 / testsuite / 26_numerics / valarray / name_lookup.cc
blob7d707ef4877768c5d02ecce0fe739f0eaae6b261
1 // 2002-08-02 gdr
3 // Copyright (C) 2002-2013 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 // Test name lookup resolutions for standard functions applied to an
22 // array expression.
23 // { dg-do compile }
25 #include <valarray>
27 namespace My
29 struct Number
31 operator bool() const;
34 Number operator+(Number);
35 Number operator-(Number);
36 Number operator~(Number);
38 bool operator!(Number);
40 Number operator+(Number, Number);
41 Number operator-(Number, Number);
42 Number operator*(Number, Number);
43 Number operator/(Number, Number);
44 Number operator%(Number, Number);
46 Number operator^(Number, Number);
47 Number operator&(Number, Number);
48 Number operator|(Number, Number);
50 Number operator<<(Number, Number);
51 Number operator>>(Number, Number);
53 bool operator==(Number, Number);
54 bool operator!=(Number, Number);
55 bool operator<(Number, Number);
56 bool operator<=(Number, Number);
57 bool operator>(Number, Number);
58 bool operator>=(Number, Number);
60 Number abs(Number);
62 Number cos(Number);
63 Number cosh(Number);
64 Number acos(Number);
66 Number sin(Number);
67 Number sinh(Number);
68 Number asin(Number);
70 Number tan(Number);
71 Number tanh(Number);
72 Number atan(Number);
74 Number exp(Number);
75 Number log(Number);
76 Number log10(Number);
77 Number sqrt(Number);
79 Number atan2(Number, Number);
80 Number pow(Number, Number);
83 int main()
85 typedef std::valarray<My::Number> Array;
86 Array u(10), v(10);
87 v = +u;
88 v = -u;
89 v = ~u;
90 std::valarray<bool> z = !u;
92 v = abs(u);
94 v = cos(u);
95 v = cosh(u);
96 v = acos(u);
98 v = sin(u);
99 v = sinh(u);
100 v = asin(u);
102 v = tan(u);
103 v = tanh(u);
104 v = atan(u);
106 v = exp(u);
107 v = log(u);
108 v = log10(u);
109 v = sqrt(u);
111 Array w = u + v;
112 w = u - v;
113 w = u * v;
114 w = u / v;
115 w = u % v;
117 w = u ^ v;
118 w = u & v;
119 w = u | v;
121 w = u << v;
122 w = u >> v;
124 z = u == v;
125 z = u != v;
126 z = u < v;
127 z = u <= v;
128 z = u > v;
129 z = u >= v;
131 w = atan2(u, v);
132 w = pow(u, v);