Fix set iterator test failure on macOS
This is a quite interesting case, where two arguments to a function are evaluated in different order on Apple Clang than on GCC and I guess MSVC. Left a comment on that.
This commit is contained in:
@@ -532,8 +532,14 @@ TEST(set, ForwardIterator)
|
||||
Set<int>::iterator iter1 = set.begin();
|
||||
int value1 = *iter1;
|
||||
Set<int>::iterator iter2 = iter1++;
|
||||
EXPECT_EQ(*iter1, *(++iter1));
|
||||
EXPECT_EQ(*iter2, value1);
|
||||
EXPECT_EQ(*(++iter2), *iter1);
|
||||
/* Interesting find: On GCC & MSVC this will succeed, as the 2nd argument is evaluated before the
|
||||
* 1st. On Apple Clang it's the other way around, and the test fails. */
|
||||
// EXPECT_EQ(*iter1, *(++iter1));
|
||||
Set<int>::iterator iter3 = ++iter1;
|
||||
/* Check that #iter1 itself changed. */
|
||||
EXPECT_EQ(*iter3, *iter1);
|
||||
}
|
||||
|
||||
TEST(set, GenericAlgorithms)
|
||||
|
Reference in New Issue
Block a user