Skip to content

Commit dcaaa1b

Browse files
committed
[test] Fix logic error in <compare> tests; enable for MSVC Dev16
Submitted upstream as https://reviews.llvm.org/D53763. llvm-svn: 351148
1 parent 1b9337f commit dcaaa1b

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

libcxx/test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ constexpr bool test_constexpr() {
130130
};
131131
for (auto TC : SpaceshipTestCases)
132132
{
133-
std::partial_ordering Res = (0 <=> TC.Value);
133+
std::partial_ordering Res = (TC.Value <=> 0);
134134
switch (TC.Expect) {
135135
case ER_Equiv:
136136
assert(Res == 0);

libcxx/test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ constexpr bool test_constexpr() {
185185
};
186186
for (auto TC : SpaceshipTestCases)
187187
{
188-
std::strong_ordering Res = (0 <=> TC.Value);
188+
std::strong_ordering Res = (TC.Value <=> 0);
189189
switch (TC.Expect) {
190190
case ER_Equiv:
191191
assert(Res == 0);

libcxx/test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ constexpr bool test_constexpr() {
142142
};
143143
for (auto TC : SpaceshipTestCases)
144144
{
145-
std::weak_ordering Res = (0 <=> TC.Value);
145+
std::weak_ordering Res = (TC.Value <=> 0);
146146
switch (TC.Expect) {
147147
case ER_Equiv:
148148
assert(Res == 0);

libcxx/test/support/test_macros.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@
210210

211211
// FIXME: Fix this feature check when either (A) a compiler provides a complete
212212
// implementation, or (b) a feature check macro is specified
213+
#if !defined(_MSC_VER) || defined(__clang__) || _MSC_VER < 1920 || _MSVC_LANG <= 201703L
213214
#define TEST_HAS_NO_SPACESHIP_OPERATOR
214-
215+
#endif
215216

216217
#if TEST_STD_VER < 11
217218
#define ASSERT_NOEXCEPT(...)

0 commit comments

Comments
 (0)