libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

initializer_list_assignment.pass.cpp (800B)


      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 
     10 // UNSUPPORTED: c++98, c++03
     11 
     12 // <string>
     13 
     14 // basic_string& operator=(initializer_list<charT> il);
     15 
     16 #include <string>
     17 #include <cassert>
     18 
     19 #include "min_allocator.h"
     20 
     21 int main()
     22 {
     23     {
     24         std::string s;
     25         s = {'a', 'b', 'c'};
     26         assert(s == "abc");
     27     }
     28     {
     29         typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
     30         S s;
     31         s = {'a', 'b', 'c'};
     32         assert(s == "abc");
     33     }
     34 }