Enable CONSTCD14 for VS2017

This commit is contained in:
James Beach 2017-01-19 17:15:43 +00:00 committed by Howard Hinnant
parent 49a59e5665
commit 186dbb2891

25
date.h
View File

@ -57,15 +57,22 @@ namespace date
// Configuration | // Configuration |
//---------------+ //---------------+
// MSVC's constexpr support is still a WIP, even in VS2015. #if defined(_MSC_VER) && !defined(__clang__)
// Fall back to a lesser mode to support it. // MSVC
// TODO: Remove this or retest later once MSVC's constexpr improves. # if _MSC_VER < 1910
#if defined(_MSC_VER) && _MSC_VER <= 1900 && ! defined(__clang__) // before VS2017
// MS cl compiler pre VS2017 # define CONSTDATA const
# define CONSTDATA const # define CONSTCD11
# define CONSTCD11 # define CONSTCD14
# define CONSTCD14 # define NOEXCEPT _NOEXCEPT
# define NOEXCEPT _NOEXCEPT # else
// VS2017 and later
# define CONSTDATA constexpr const
# define CONSTCD11 constexpr
# define CONSTCD14 constexpr
# define NOEXCEPT noexcept
# endif
#elif __cplusplus >= 201402 #elif __cplusplus >= 201402
// C++14 // C++14
# define CONSTDATA constexpr const # define CONSTDATA constexpr const