ExceptionWrapperTest.cpp vs clang's new warning about side effects in typeid argument...
authorJim Meyering <meyering@fb.com>
Sat, 14 Feb 2015 01:20:06 +0000 (17:20 -0800)
committerAlecs King <int@fb.com>
Tue, 3 Mar 2015 03:21:07 +0000 (19:21 -0800)
commit82b788f506cb45e44921c42337efb93e4bfe3656
treecf70eb49780d557c38a3fad97f3adb54323fafd5
parent2b4d1dea72dda8611716b987b60038fe34460a86
ExceptionWrapperTest.cpp vs clang's new warning about side effects in typeid argument list

Summary:
Disable the -Wunevaluated-expression warning for this test:

EXPECT_EQ(typeid(ie), typeid(IntException));

Otherwise, clang warns about the unevaluated expression because
the expansion of EXPECT_EQ applies sizeof to an expression
with side effects:

folly/test/ExceptionWrapperTest.cpp:179:122: error: expression with side effects has no effect in an unevaluated context [-Werror,-Wunevaluated-expression]
switch (0) case 0: default: if (const ::testing::AssertionResult gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(typeid(ie))) == 1)>::Compare("typeid(ie)", "typeid(IntException)", typeid(ie), typeid(IntException)))) ; else ::testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "folly/test/ExceptionWrapperTest.cpp", 179, gtest_ar.failure_message()) = ::testing::Message();

Test Plan:
Ensure this compiles with clang-3.4, 3.5 and clang:dev.
I.e., ensure that this prints PASS at the end.

for i in '' 3.5 dev; do
test -n "$i" && i=--with-project-version=clang:$i
fbconfig -r --clang $i folly/test:exception_wrapper_test && fbmake dbgo
done && echo PASS

Reviewed By: mpawlowski@fb.com

Subscribers: mathieubaudet, folly-diffs@, yfeldblum

FB internal diff: D1850778

Tasks: 6244745

Signature: t1:1850778:1424111029:136478e9a3cc3a219047547d501de4c579a1a181
folly/test/ExceptionWrapperTest.cpp