]> granicus.if.org Git - icu/commitdiff
ICU-13258 Add work-around for char16_t as a typedef in older versions of Visual Studi...
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Tue, 27 Feb 2018 01:17:08 +0000 (01:17 +0000)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Tue, 27 Feb 2018 01:17:08 +0000 (01:17 +0000)
X-SVN-Rev: 40990

icu4c/source/common/unicode/platform.h
icu4c/source/common/unicode/umachine.h

index 56f8e5e5b0f2536515f18bcbb6ec0a32564322fe..c63fce6e6d80ae0796707b0d2e096d6e32f3f8d4 100644 (file)
@@ -749,8 +749,10 @@ namespace std {
 #else
     /*
      * Notes:
-     * Visual Studio 10 (_MSC_VER>=1600) defines char16_t but
-     * does not support u"abc" string literals.
+     * Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef
+     * and does not support u"abc" string literals.
+     * Visual Studio 2015 (_MSC_VER>=1900) and above adds support for
+     * both char16_t and u"abc" string literals.
      * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but
      * does not support u"abc" string literals.
      * C++11 and C11 require support for UTF-16 literals
index 3ba9161d2a5f68f2e557291f5ad743659cdded26..98bbd02160fada3b1178bb453b9fedd9e2d69c25 100644 (file)
@@ -299,6 +299,10 @@ typedef int8_t UBool;
 // for AIX, uchar.h needs to be included
 # include <uchar.h>
 # define U_CHAR16_IS_TYPEDEF 1
+#elif defined(_MSC_VER) && (_MSC_VER < 1900)
+// Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type,
+// and instead use a typedef.  https://msdn.microsoft.com/library/bb531344.aspx
+# define U_CHAR16_IS_TYPEDEF 1
 #else
 # define U_CHAR16_IS_TYPEDEF 0
 #endif