15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <valarray>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // template<class T> class valarray;
125a83710eSEric Fiselier 
135a83710eSEric Fiselier // template<class T>
145a83710eSEric Fiselier //   valarray<bool>
155a83710eSEric Fiselier //   operator&&(const valarray<T>& x, const valarray<T>& y);
165a83710eSEric Fiselier 
175a83710eSEric Fiselier #include <valarray>
185a83710eSEric Fiselier #include <cassert>
19e898b484SStephan T. Lavavej #include <cstddef>
205a83710eSEric Fiselier 
217fc6a556SMarshall Clow #include "test_macros.h"
227fc6a556SMarshall Clow 
main(int,char **)232df59c50SJF Bastien int main(int, char**)
245a83710eSEric Fiselier {
255a83710eSEric Fiselier     {
265a83710eSEric Fiselier         typedef int T;
275a83710eSEric Fiselier         T a1[] = {1,  2,  3,  4,  0};
285a83710eSEric Fiselier         T a2[] = {6,  7,  0,  9, 10};
295a83710eSEric Fiselier         bool a3[] = {true,  true,  false,  true,  false};
30*469d18c0SArthur O'Dwyer         const unsigned N = 5;
315a83710eSEric Fiselier         std::valarray<T> v1(a1, N);
325a83710eSEric Fiselier         std::valarray<T> v2(a2, N);
335a83710eSEric Fiselier         std::valarray<bool> v3 = v1 && v2;
34*469d18c0SArthur O'Dwyer         std::valarray<bool> v3a = +(v1 && v2);
35*469d18c0SArthur O'Dwyer         assert(v3.size() == N);
36*469d18c0SArthur O'Dwyer         assert(v3a.size() == N);
37*469d18c0SArthur O'Dwyer         for (std::size_t i = 0; i < N; ++i) {
385a83710eSEric Fiselier             assert(v3[i] == a3[i]);
39*469d18c0SArthur O'Dwyer             assert(v3a[i] == a3[i]);
40*469d18c0SArthur O'Dwyer         }
415a83710eSEric Fiselier     }
422df59c50SJF Bastien 
432df59c50SJF Bastien   return 0;
445a83710eSEric Fiselier }
45