101542.cc 601 B

123456789101112131415161718192021222324252627
  1. // { dg-do run { target c++11 } }
  2. // PR libstdc++/101542
  3. #include <ext/rope>
  4. #include <testsuite_hooks.h>
  5. template<typename T> T f(T x) { return x; }
  6. template<typename T> T g(T x) { return std::move(x); }
  7. int main()
  8. {
  9. std::string s;
  10. {
  11. __gnu_cxx::sequence_buffer<std::string> a(s);
  12. {
  13. __gnu_cxx::sequence_buffer<std::string> b = std::move(a);
  14. b.push_back('h');
  15. b.push_back('e');
  16. b.push_back('l');
  17. b.push_back('l');
  18. b.push_back('o');
  19. __gnu_cxx::sequence_buffer<std::string> c;
  20. c = f(g((std::move(b))));
  21. }
  22. }
  23. VERIFY( s == "hello" );
  24. }