assign_copy.pass.cpp 668 B

123456789101112131415161718192021222324252627282930313233
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <stack>
  10. // stack& operator=(const stack& q);
  11. #include <stack>
  12. #include <cassert>
  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()
  23. {
  24. std::stack<int> q(make<std::deque<int> >(5));
  25. std::stack<int> q2;
  26. q2 = q;
  27. assert(q2 == q);
  28. }