Debian Codegraph @

libcxx/test/std/numerics/numarray/template.valarray/valarray.cons/default.pass.cpp

raw
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 valarray;
12
13 // valarray();
14
15 #include <valarray>
16 #include <cassert>
17
18 #include "test_macros.h"
19
20 struct S {
21 S() { ctor_called = true; }
22 static bool ctor_called;
23 };
24
25 bool S::ctor_called = false;
26
27 int main(int, char**)
28 {
29 {
30 std::valarray<int> v;
31 assert(v.size() == 0);
32 }
33 {
34 std::valarray<float> v;
35 assert(v.size() == 0);
36 }
37 {
38 std::valarray<double> v;
39 assert(v.size() == 0);
40 }
41 {
42 std::valarray<std::valarray<double> > v;
43 assert(v.size() == 0);
44 }
45 {
46 std::valarray<S> v;
47 assert(v.size() == 0);
48 assert(!S::ctor_called);
49 }
50
51 return 0;
52 }