ctor_copy.pass.cpp 735 B

1234567891011121314151617181920212223242526272829303132333435
  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. // <stack>
  9. // stack(const stack&) = default;
  10. #include <stack>
  11. #include <cassert>
  12. #include "test_macros.h"
  13. template <class C>
  14. C
  15. make(int n)
  16. {
  17. C c;
  18. for (int i = 0; i < n; ++i)
  19. c.push_back(i);
  20. return c;
  21. }
  22. int main(int, char**)
  23. {
  24. std::stack<int> q(make<std::deque<int> >(5));
  25. std::stack<int> q2 = q;
  26. assert(q2 == q);
  27. return 0;
  28. }