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
This commit is contained in:
Jeff Genovy 2018-02-27 01:17:08 +00:00
parent 9ab182f2fb
commit 216c856d80
2 changed files with 8 additions and 2 deletions

View 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

View 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