[llvm] r275717 - Fix warnings in ImmutableSetTest and SequenceTest.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 17 11:10:30 PDT 2016
Author: jlebar
Date: Sun Jul 17 13:10:30 2016
New Revision: 275717
URL: http://llvm.org/viewvc/llvm-project?rev=275717&view=rev
Log:
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.
Modified:
llvm/trunk/unittests/ADT/ImmutableSetTest.cpp
llvm/trunk/unittests/ADT/SequenceTest.cpp
Modified: llvm/trunk/unittests/ADT/ImmutableSetTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ImmutableSetTest.cpp?rev=275717&r1=275716&r2=275717&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/ImmutableSetTest.cpp (original)
+++ llvm/trunk/unittests/ADT/ImmutableSetTest.cpp Sun Jul 17 13:10:30 2016
@@ -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);
}
Modified: llvm/trunk/unittests/ADT/SequenceTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SequenceTest.cpp?rev=275717&r1=275716&r2=275717&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/SequenceTest.cpp (original)
+++ llvm/trunk/unittests/ADT/SequenceTest.cpp Sun Jul 17 13:10:30 2016
@@ -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);
More information about the llvm-commits
mailing list