sammccall accepted this revision. sammccall added inline comments.
================ Comment at: clangd/Function.h:157 + + ScopeExitGuard(ScopeExitGuard &&Other) + : F(std::move(Other.F)), Moved(Other.Moved) { ---------------- ilya-biryukov wrote: > sammccall wrote: > > I'm struggling to think of cases where moving these guards is the right > > solution. > > Can we delete the move ops until we need them? It seems to make this class > > almost trivial. > We need moves as we return the class by value from the `onScopeGuard` > function. Neither of these will compile without move constructors: > ``` > auto Guard = onScopeGuard([]() { /*...*/ }); > auto Guard2(onScopeGuard([]() { /*...*/ })); > auto Guard3{onScopeGuard([]() { /*...*/ })}; > ``` > Of course :-) As you pointed out offline, making the member Optional<Func> would let you use the default move operators at least. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D40486 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits