1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Fix warnings in ImmutableSetTest and SequenceTest.

Doing "I++" inside of an EXPECT_* triggers

  warning: expression with side effects has no effect in an unevaluated context

because EXPECT_* partially expands to

  EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(i++)) == 1)>

which is an unevaluated context.

llvm-svn: 275717
This commit is contained in:
Justin Lebar 2016-07-17 18:10:30 +00:00
parent c97129cc02
commit bade3bc474
2 changed files with 10 additions and 5 deletions

View File

@ -181,19 +181,22 @@ TEST_F(ImmutableSetTest, IterLongSetTest) {
int i = 0;
for (ImmutableSet<long>::iterator I = S.begin(), E = S.end(); I != E; ++I) {
ASSERT_EQ(i++, *I);
ASSERT_EQ(i, *I);
i++;
}
ASSERT_EQ(0, i);
i = 0;
for (ImmutableSet<long>::iterator I = S2.begin(), E = S2.end(); I != E; ++I) {
ASSERT_EQ(i++, *I);
ASSERT_EQ(i, *I);
i++;
}
ASSERT_EQ(3, i);
i = 0;
for (ImmutableSet<long>::iterator I = S3.begin(), E = S3.end(); I != E; I++) {
ASSERT_EQ(i++, *I);
ASSERT_EQ(i, *I);
i++;
}
ASSERT_EQ(6, i);
}

View File

@ -18,8 +18,10 @@ namespace {
TEST(SequenceTest, Basic) {
int x = 0;
for (int i : seq(0, 10))
EXPECT_EQ(x++, i);
for (int i : seq(0, 10)) {
EXPECT_EQ(x, i);
x++;
}
EXPECT_EQ(10, x);
auto my_seq = seq(0, 4);