STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Use L"cat" L"dog" when concatenating string literals.

MSVC dislikes seeing L"23" "\x65F6". It's actually unclear to me what the 
Standard says here - I suspect that MSVC is correct. This depends on the phases 
of translation, and step 5 interprets string literals before step 6 
concatenates them. I don't believe that the wideness of the first string 
literal is allowed to affect the second string literal before step 6 happens.

In any event, we can sidestep this arcane question by marking all of the string 
literals as wide.

Fixes MSVC "error C2022: '26102': too big for character".

http://reviews.llvm.org/D21713

Files:
  
test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp

Index: 
test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
===================================================================
--- 
test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
+++ 
test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
@@ -75,7 +75,7 @@
     }
     {
         const my_facet f(LOCALE_fr_FR_UTF_8, 1);
-        const wchar_t in[] = L"Sam 31 d""\xE9""c 23:55:59 2061";
+        const wchar_t in[] = L"Sam 31 d" L"\xE9" L"c 23:55:59 2061";
         err = std::ios_base::goodbit;
         t = std::tm();
         I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 
'c');
@@ -105,11 +105,11 @@
     {
         const my_facet f("ru_RU", 1);
         const wchar_t in[] = L"\x441\x443\x431\x431\x43E\x442\x430"
-                          ", 31 "
-                          "\x434\x435\x43A\x430\x431\x440\x44F"
-                          " 2061 "
-                          "\x433"
-                          ". 23:55:59";
+                          L", 31 "
+                          L"\x434\x435\x43A\x430\x431\x440\x44F"
+                          L" 2061 "
+                          L"\x433"
+                          L". 23:55:59";
         err = std::ios_base::goodbit;
         t = std::tm();
         I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 
'c');
@@ -140,7 +140,7 @@
     {
         const my_facet f("zh_CN", 1);
         const wchar_t in[] = L"\x516D"
-                          " 12/31 23:55:59 2061";
+                          L" 12/31 23:55:59 2061";
         err = std::ios_base::goodbit;
         t = std::tm();
         I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 
'c');
@@ -157,7 +157,7 @@
 #endif
     {
         const my_facet f(LOCALE_zh_CN_UTF_8, 1);
-        const wchar_t in[] = L"23""\x65F6""55""\x5206""59""\x79D2";
+        const wchar_t in[] = L"23" L"\x65F6" L"55" L"\x5206" L"59" L"\x79D2";
         err = std::ios_base::goodbit;
         t = std::tm();
         I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 
'X');


Index: test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
===================================================================
--- test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
+++ test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
@@ -75,7 +75,7 @@
     }
     {
         const my_facet f(LOCALE_fr_FR_UTF_8, 1);
-        const wchar_t in[] = L"Sam 31 d""\xE9""c 23:55:59 2061";
+        const wchar_t in[] = L"Sam 31 d" L"\xE9" L"c 23:55:59 2061";
         err = std::ios_base::goodbit;
         t = std::tm();
         I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
@@ -105,11 +105,11 @@
     {
         const my_facet f("ru_RU", 1);
         const wchar_t in[] = L"\x441\x443\x431\x431\x43E\x442\x430"
-                          ", 31 "
-                          "\x434\x435\x43A\x430\x431\x440\x44F"
-                          " 2061 "
-                          "\x433"
-                          ". 23:55:59";
+                          L", 31 "
+                          L"\x434\x435\x43A\x430\x431\x440\x44F"
+                          L" 2061 "
+                          L"\x433"
+                          L". 23:55:59";
         err = std::ios_base::goodbit;
         t = std::tm();
         I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
@@ -140,7 +140,7 @@
     {
         const my_facet f("zh_CN", 1);
         const wchar_t in[] = L"\x516D"
-                          " 12/31 23:55:59 2061";
+                          L" 12/31 23:55:59 2061";
         err = std::ios_base::goodbit;
         t = std::tm();
         I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
@@ -157,7 +157,7 @@
 #endif
     {
         const my_facet f(LOCALE_zh_CN_UTF_8, 1);
-        const wchar_t in[] = L"23""\x65F6""55""\x5206""59""\x79D2";
+        const wchar_t in[] = L"23" L"\x65F6" L"55" L"\x5206" L"59" L"\x79D2";
         err = std::ios_base::goodbit;
         t = std::tm();
         I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to