1*0a6a1f1dSLionel Sambuc // -*- C++ -*-
2*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
3*0a6a1f1dSLionel Sambuc //
4*0a6a1f1dSLionel Sambuc // The LLVM Compiler Infrastructure
5*0a6a1f1dSLionel Sambuc //
6*0a6a1f1dSLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
7*0a6a1f1dSLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
8*0a6a1f1dSLionel Sambuc //
9*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
10*0a6a1f1dSLionel Sambuc #include <string>
11*0a6a1f1dSLionel Sambuc #include <cassert>
12*0a6a1f1dSLionel Sambuc
main()13*0a6a1f1dSLionel Sambuc int main()
14*0a6a1f1dSLionel Sambuc {
15*0a6a1f1dSLionel Sambuc #if _LIBCPP_STD_VER > 11
16*0a6a1f1dSLionel Sambuc using namespace std::literals::string_literals;
17*0a6a1f1dSLionel Sambuc
18*0a6a1f1dSLionel Sambuc static_assert ( std::is_same<decltype( "Hi"s), std::string>::value, "" );
19*0a6a1f1dSLionel Sambuc static_assert ( std::is_same<decltype( u8"Hi"s), std::string>::value, "" );
20*0a6a1f1dSLionel Sambuc static_assert ( std::is_same<decltype( L"Hi"s), std::wstring>::value, "" );
21*0a6a1f1dSLionel Sambuc static_assert ( std::is_same<decltype( u"Hi"s), std::u16string>::value, "" );
22*0a6a1f1dSLionel Sambuc static_assert ( std::is_same<decltype( U"Hi"s), std::u32string>::value, "" );
23*0a6a1f1dSLionel Sambuc
24*0a6a1f1dSLionel Sambuc std::string foo;
25*0a6a1f1dSLionel Sambuc std::wstring Lfoo;
26*0a6a1f1dSLionel Sambuc std::u16string ufoo;
27*0a6a1f1dSLionel Sambuc std::u32string Ufoo;
28*0a6a1f1dSLionel Sambuc
29*0a6a1f1dSLionel Sambuc foo = ""s; assert( foo.size() == 0);
30*0a6a1f1dSLionel Sambuc foo = u8""s; assert( foo.size() == 0);
31*0a6a1f1dSLionel Sambuc Lfoo = L""s; assert(Lfoo.size() == 0);
32*0a6a1f1dSLionel Sambuc ufoo = u""s; assert(ufoo.size() == 0);
33*0a6a1f1dSLionel Sambuc Ufoo = U""s; assert(Ufoo.size() == 0);
34*0a6a1f1dSLionel Sambuc
35*0a6a1f1dSLionel Sambuc foo = " "s; assert( foo.size() == 1);
36*0a6a1f1dSLionel Sambuc foo = u8" "s; assert( foo.size() == 1);
37*0a6a1f1dSLionel Sambuc Lfoo = L" "s; assert(Lfoo.size() == 1);
38*0a6a1f1dSLionel Sambuc ufoo = u" "s; assert(ufoo.size() == 1);
39*0a6a1f1dSLionel Sambuc Ufoo = U" "s; assert(Ufoo.size() == 1);
40*0a6a1f1dSLionel Sambuc
41*0a6a1f1dSLionel Sambuc foo = "ABC"s; assert( foo == "ABC"); assert( foo == std::string ( "ABC"));
42*0a6a1f1dSLionel Sambuc foo = u8"ABC"s; assert( foo == u8"ABC"); assert( foo == std::string (u8"ABC"));
43*0a6a1f1dSLionel Sambuc Lfoo = L"ABC"s; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring ( L"ABC"));
44*0a6a1f1dSLionel Sambuc ufoo = u"ABC"s; assert(ufoo == u"ABC"); assert(ufoo == std::u16string( u"ABC"));
45*0a6a1f1dSLionel Sambuc Ufoo = U"ABC"s; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string( U"ABC"));
46*0a6a1f1dSLionel Sambuc #endif
47*0a6a1f1dSLionel Sambuc }
48