From: Jérémie Galarneau Date: Fri, 22 Mar 2024 15:46:36 +0000 (-0400) Subject: Fix: waiter: use std::reference_wrapper instead of a raw reference X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=ac8791840c1815f10336210b4c0d7046eb515692;hp=ac8791840c1815f10336210b4c0d7046eb515692;p=lttng-tools.git Fix: waiter: use std::reference_wrapper instead of a raw reference clang-tidy warns that /home/jgalar/EfficiOS/src/lttng-tools/src/common/waiter.hpp:32:9: warning: use '= default' to define a trivial copy-assignment operator [modernize-use-equals-default] The warning itself is bogus since it is not possible to use the default copy-assignment operator in this case. Indeed, _state being a reference, it cannot be rebound after its initialization. The compiler will refuse to generate a default implementation as it would be ill-formed. However, this does highlight a problem in the implementation, namely that the explicit assignment operator does attempt to re-assign _state. Switching the _state reference to use std::reference_wrapper does make it legal to re-bind the reference to a different object. Having the ability to assign a waker is conceptually a bit strange (vs obtaining another instance from the waiter) and should probably be disabled, but it is required for the moment as one the of use in a huge C structure that gets copied using by assignment. Signed-off-by: Jérémie Galarneau Change-Id: I6f4c740244decb50426ec0571aaea754edaea6a5 ---