AK: Fully qualify use of move in TemporaryChange

For some reason, after some seemingly unrelated upcoming changes, the
unqualified `move`s in this header result in an ADL failure:

AK/TemporaryChange.h:22:39: error: call to function 'move' that is
neither visible in the template definition nor found by argument-
dependent lookup
   22 |     ~TemporaryChange() { m_variable = move(m_old_value); }
      |                                       ^

Libraries/LibDNS/Resolver.h:491:29: note: in instantiation of member
function 'AK::TemporaryChange<bool>::~TemporaryChange' requested here
  491 |             TemporaryChange change(m_attempting_restart, true);
This commit is contained in:
Timothy Flynn 2025-03-20 14:40:35 -04:00 committed by Alexander Kalenik
parent cbf47abd24
commit 3961a4f16a
Notes: github-actions[bot] 2025-03-22 16:29:33 +00:00

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/Platform.h>
#include <AK/StdLibExtras.h>
namespace AK {
@ -15,11 +16,15 @@ class TemporaryChange {
public:
TemporaryChange(T& variable, T value)
: m_variable(variable)
, m_old_value(move(variable))
, m_old_value(AK::move(variable))
{
m_variable = move(value);
m_variable = AK::move(value);
}
~TemporaryChange()
{
m_variable = AK::move(m_old_value);
}
~TemporaryChange() { m_variable = move(m_old_value); }
private:
T& m_variable;