initializer_list_assignment.pass.cpp 800 B

12345678910111213141516171819202122232425262728293031323334
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // UNSUPPORTED: c++98, c++03
  10. // <string>
  11. // basic_string& operator=(initializer_list<charT> il);
  12. #include <string>
  13. #include <cassert>
  14. #include "min_allocator.h"
  15. int main()
  16. {
  17. {
  18. std::string s;
  19. s = {'a', 'b', 'c'};
  20. assert(s == "abc");
  21. }
  22. {
  23. typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
  24. S s;
  25. s = {'a', 'b', 'c'};
  26. assert(s == "abc");
  27. }
  28. }