Commit cb2d6c84 authored by Jim Meyering's avatar Jim Meyering Committed by Alecs King

folly: OptionalTest.cpp: suppress a -Wself-move warning

Summary:
Clang's new -Wself-move warning dings this code:

b = std::move(b);

But in this case, that is a deliberate test of
this capability, so we suppress that particular
warning for the duration of this small test function.

Test Plan:
Run this and note that it now compiles: (it passes the tests, too)
fbconfig --clang --with-project-version=clang:dev -r folly/test:optional_test && fbmake dbgo

Reviewed By: watashi@fb.com

Subscribers: folly-diffs@, yfeldblum

FB internal diff: D1849689

Tasks: 6244745

Signature: t1:1849689:1423877932:4f479d682bd8ba97dcabed7fc29ce0a22c013969

@build-break (using this to work around bogus push failure: https://phabricator.fb.com/P19730606)
parent a3259f63
......@@ -432,6 +432,13 @@ TEST(Optional, MakeOptional) {
EXPECT_EQ(**optIntPtr, 3);
}
#ifdef __clang__
# pragma clang diagnostic push
# if __clang_major__ > 3 || __clang_minor__ >= 6
# pragma clang diagnostic ignored "-Wself-move"
# endif
#endif
TEST(Optional, SelfAssignment) {
Optional<int> a = 42;
a = a;
......@@ -442,6 +449,10 @@ TEST(Optional, SelfAssignment) {
ASSERT_TRUE(b.hasValue() && b.value() == 23333333);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
class ContainsOptional {
public:
ContainsOptional() { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment