Skip to content

Commit db7add9

Browse files
committed
MSVC fixes
1 parent 5ec21f2 commit db7add9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

include/tl/expected.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
#if !defined(TL_ASSERT)
5555
//can't have assert in constexpr in C++11 and GCC 4.9 has a compiler bug
56-
#if (__cplusplus > 201103L) && !defined(TL_EXPECTED_GCC49)
56+
#if (TL_CPLUSPLUS > 201103L) && !defined(TL_EXPECTED_GCC49)
5757
#include <cassert>
5858
#define TL_ASSERT(x) assert(x)
5959
#else
@@ -109,7 +109,13 @@ struct is_trivially_copy_constructible<std::vector<T, A>> : std::false_type {};
109109
std::is_trivially_destructible<T>
110110
#endif
111111

112-
#if __cplusplus > 201103L || (defined(_MSC_VER) && _MSC_VER >= 1910)
112+
#ifdef _MSVC_LANG
113+
#define TL_CPLUSPLUS _MSVC_LANG
114+
#else
115+
#define TL_CPLUSPLUS __cplusplus
116+
#endif
117+
118+
#if TL_CPLUSPLUS > 201103L
113119
#define TL_EXPECTED_CXX14
114120
#endif
115121

@@ -119,7 +125,7 @@ struct is_trivially_copy_constructible<std::vector<T, A>> : std::false_type {};
119125
#define TL_EXPECTED_GCC49_CONSTEXPR constexpr
120126
#endif
121127

122-
#if (__cplusplus == 201103L || defined(TL_EXPECTED_MSVC2015) || \
128+
#if (TL_CPLUSPLUS == 201103L || defined(TL_EXPECTED_MSVC2015) || \
123129
defined(TL_EXPECTED_GCC49))
124130
#define TL_EXPECTED_11_CONSTEXPR
125131
#else

0 commit comments

Comments
 (0)