with recent clang, this triggers -Wunevaluated-expression

specifically, "expression with side effects has no effect in an unevaluated context"
This commit is contained in:
Eli Fidler 2016-05-31 11:37:39 -04:00
parent 035271091f
commit 5c77c9248c

View File

@ -1119,14 +1119,18 @@ TEST(Value, ArrayHelperRangeFor) {
{
int i = 0;
for (auto& v : x.GetArray())
EXPECT_EQ(i++, v.GetInt());
for (auto& v : x.GetArray()) {
EXPECT_EQ(i, v.GetInt());
i++;
}
EXPECT_EQ(i, 10);
}
{
int i = 0;
for (const auto& v : const_cast<const Value&>(x).GetArray())
EXPECT_EQ(i++, v.GetInt());
for (const auto& v : const_cast<const Value&>(x).GetArray()) {
EXPECT_EQ(i, v.GetInt());
i++;
}
EXPECT_EQ(i, 10);
}