default.pass.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. // <valarray>
  9. // template<class T> class valarray;
  10. // valarray();
  11. #include <valarray>
  12. #include <cassert>
  13. struct S {
  14. S() { ctor_called = true; }
  15. static bool ctor_called;
  16. };
  17. bool S::ctor_called = false;
  18. int main(int, char**)
  19. {
  20. {
  21. std::valarray<int> v;
  22. assert(v.size() == 0);
  23. }
  24. {
  25. std::valarray<float> v;
  26. assert(v.size() == 0);
  27. }
  28. {
  29. std::valarray<double> v;
  30. assert(v.size() == 0);
  31. }
  32. {
  33. std::valarray<std::valarray<double> > v;
  34. assert(v.size() == 0);
  35. }
  36. {
  37. std::valarray<S> v;
  38. assert(v.size() == 0);
  39. assert(!S::ctor_called);
  40. }
  41. return 0;
  42. }