From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Tue, 27 Feb 2018 01:17:08 +0000 (+0000) Subject: ICU-13258 Add work-around for char16_t as a typedef in older versions of Visual Studi... X-Git-Tag: release-61-rc~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=216c856d80b01f0942bdcf0e7f85fe118e7ce6da;p=icu ICU-13258 Add work-around for char16_t as a typedef in older versions of Visual Studio (prior to VS 2015). X-SVN-Rev: 40990 --- diff --git a/icu4c/source/common/unicode/platform.h b/icu4c/source/common/unicode/platform.h index 56f8e5e5b0f..c63fce6e6d8 100644 --- a/icu4c/source/common/unicode/platform.h +++ b/icu4c/source/common/unicode/platform.h @@ -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 diff --git a/icu4c/source/common/unicode/umachine.h b/icu4c/source/common/unicode/umachine.h index 3ba9161d2a5..98bbd02160f 100644 --- a/icu4c/source/common/unicode/umachine.h +++ b/icu4c/source/common/unicode/umachine.h @@ -299,6 +299,10 @@ typedef int8_t UBool; // for AIX, uchar.h needs to be included # include # 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