From: Christopher Dykes Date: Thu, 11 Aug 2016 22:38:49 +0000 (-0700) Subject: Construct TestObject in AtomicLinkedListTest via a const reference X-Git-Tag: v2016.08.15.00~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=591b9f3e6893af3afd567516fecf6ca015aaedff;p=folly.git Construct TestObject in AtomicLinkedListTest via a const reference Summary: MSVC doesn't currently guarantee left-to-right argument evaluation order for values constructed via braced initializers, and produces a warning if you try to pass an argument with a non-trivial copy constructor by-value in a constructor used by the braced initializer. This prevents the warning by simply accepting a const reference instead. Reviewed By: yfeldblum Differential Revision: D3705073 fbshipit-source-id: 917ec1bb776d6ec4bfefe50907d4c5ac2f2379b1 --- diff --git a/folly/test/AtomicLinkedListTest.cpp b/folly/test/AtomicLinkedListTest.cpp index 0abe82c6..b13c24c9 100644 --- a/folly/test/AtomicLinkedListTest.cpp +++ b/folly/test/AtomicLinkedListTest.cpp @@ -153,7 +153,8 @@ TEST(AtomicIntrusiveLinkedList, Stress) { class TestObject { public: - TestObject(size_t id__, std::shared_ptr ptr) : id_(id__), ptr_(ptr) {} + TestObject(size_t id__, const std::shared_ptr& ptr) + : id_(id__), ptr_(ptr) {} size_t id() { return id_;