This is an automated email from the ASF dual-hosted git repository.

asekretenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 213d2ab  Fixed compilation failure due to type mis-deduction in 
`createRE2()`.
213d2ab is described below

commit 213d2ab3da13232802805d81ed675c23fe1d2d51
Author: Andrei Sekretenko <[email protected]>
AuthorDate: Fri Aug 28 18:15:23 2020 +0200

    Fixed compilation failure due to type mis-deduction in `createRE2()`.
    
    This fixes compilation failure on pre-3.9.0 clang/pre-8.0.0 gcc
    introduced by 470665e1575b9a91dffca974485940c7a0a1fe37 which is
    caused by the compilers deducing the type of the argument of
    `template<T> Try(T&&)` forwarding constructor in the return statement
    to be `unique_ptr&` instead of `unique_ptr`.
---
 src/master/allocator/mesos/offer_constraints_filter.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/master/allocator/mesos/offer_constraints_filter.cpp 
b/src/master/allocator/mesos/offer_constraints_filter.cpp
index 30b671b..441ebc1 100644
--- a/src/master/allocator/mesos/offer_constraints_filter.cpp
+++ b/src/master/allocator/mesos/offer_constraints_filter.cpp
@@ -68,7 +68,9 @@ static Try<unique_ptr<const RE2>> createRE2(
         stringify(limits.maxProgramSize) + " allowed");
   }
 
-  return re2;
+  // Without `std::move`, pre-8.0.0 gcc and pre-3.9.0 clang deduce the type of
+  // `T` in `template<T> Try<>::Try(T&&)` to be `unique_ptr&`, not 
`unique_ptr`.
+  return std::move(re2);
 }
 
 

Reply via email to