Skip to content

Commit c8214a0

Browse files
authored
Merge pull request #345 from puetzk/_MSVC_TRADITIONAL-__VA_OPT__
Fix feature detection of __VA_OPT__ for MSVC
2 parents eaeb89c + cb808e2 commit c8214a0

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,13 @@ jobs:
16751675
cc: "cl", cxx: "cl",
16761676
cxx_standard: 20,
16771677
}
1678+
- {
1679+
name: "Windows MSVC 2022 C++20 __cppstd",
1680+
os: windows-2022,
1681+
cc: "cl", cxx: "cl",
1682+
cxx_standard: 20,
1683+
cxx_flags: "/Zc:__cplusplus"
1684+
}
16781685
- {
16791686
name: "Windows MSVC 2022 C++20 preprocessor",
16801687
os: windows-2022,
@@ -1729,6 +1736,13 @@ jobs:
17291736
cc: "cl", cxx: "cl",
17301737
cxx_standard: 20,
17311738
}
1739+
- {
1740+
name: "Windows MSVC 2019 C++20 __cppstd",
1741+
os: windows-2019,
1742+
cc: "cl", cxx: "cl",
1743+
cxx_standard: 20,
1744+
cxx_flags: "/Zc:__cplusplus"
1745+
}
17321746
- {
17331747
name: "Windows MSVC 2019 C++20 preprocessor",
17341748
os: windows-2019,

include/trompeloeil/mock.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,15 @@
122122
#define TROMPELOEIL_NOT_IMPLEMENTED(...) __VA_ARGS__
123123
#endif
124124

125-
#if defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL==0
126-
# if _MSC_VER >= 1940
127-
# define TROMPELOEIL_HAS_VA_OPT 1
128-
# else
129-
# define TROMPELOEIL_HAS_VA_OPT 0
125+
#if defined(_MSVC_TRADITIONAL)
126+
# if _MSVC_TRADITIONAL==0
127+
# if (_MSC_VER >= 1940) || ((_MSVC_VER >= 1926) && (_MSVC_LANG > 201703L))
128+
# define TROMPELOEIL_HAS_VA_OPT 1
129+
# else
130+
# define TROMPELOEIL_HAS_VA_OPT 0
131+
# endif
132+
# define TROMPELOEIL_MSVC_PREPROCESSOR 0
130133
# endif
131-
# define TROMPELOEIL_MSVC_PREPROCESSOR 0
132134
#elif __cplusplus >= 202002L
133135
# define TROMPELOEIL_HAS_VA_OPT 1
134136
#else

0 commit comments

Comments
 (0)