1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <valarray>
10 
11 // template <class T> class slice_array
12 
13 // void operator=(const T& value) const;
14 
15 #include <valarray>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 
main(int,char **)20 int main(int, char**)
21 {
22     double a[] = { 0, 0, 0 };
23     std::valarray<double> m(a, sizeof(a)/sizeof(a[0]));
24     std::slice_array<double> s = m[std::slice(0, 3, 1)];
25     s = 42;
26     assert(m[0] == 42);
27     assert(m[1] == 42);
28     assert(m[2] == 42);
29 
30     ASSERT_SAME_TYPE(decltype(s = 42), void);
31 
32     return 0;
33 }
34