Skip to content

Commit 477aece

Browse files
committed
Add guard on forwarding constructor
1 parent 03b292c commit 477aece

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utils/utils.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ namespace detail {
283283
F f;
284284
bool active;
285285
public:
286-
template<typename G>
286+
template<
287+
typename G,
288+
typename std::enable_if<!std::is_same<typename std::decay<G>::type, scope_guard<F>>::value, int>::type = 0
289+
>
287290
scope_guard(G&& f) : f(std::forward<F>(f)), active(true) {}
288291
~scope_guard() {
289292
if(active) {

0 commit comments

Comments
 (0)