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
Showing
Please register or sign in to comment