rocm_smi_lib icon indicating copy to clipboard operation
rocm_smi_lib copied to clipboard

remove const for ScopeGuard operator

Open trixirt opened this issue 1 year ago • 2 comments

With gcc 14 on Fedora rawhide, there is this build error

[ 3%] Building CXX object rocm_smi/CMakeFiles/rocm_smi64.dir/__/src/rocm_smi_device.cc.o In file included from rocm_smi_lib/src/rocm_smi_device.cc:67: rocm_smi_lib/include/rocm_smi/rocm_smi_utils.h: In member function ‘amd::smi::ScopeGuard& amd::smi::ScopeGuard::operator=(const amd::smi::ScopeGuard&)’: /home/trix/rocm/rocm_smi_lib/include/rocm_smi/rocm_smi_utils.h:222:18: error: assignment of member ‘dismiss_’ in read-only object 222 | rhs.dismiss_ = true; | ~~~~~~~~~~~~~^~~~~~

The rhs parameter can not be const and setting a sideeffect. So remove const

trixirt avatar Jan 30 '24 12:01 trixirt

@cfreehill , could you check this? rocm_smi_lib fails to compile with clang-19 too.

/var/tmp/portage/dev-util/rocm-smi-6.1.1/work/rocm_smi_lib-rocm-6.1.1/include/rocm_smi/rocm_smi_utils.h:237:18: error: cannot assign to variable 'rhs' with const-qualified type 'const ScopeGuard<lambda> &'
  237 |     rhs.dismiss_ = true;
      |     ~~~~~~~~~~~~ ^

Original commit was https://github.com/ROCm/rocm_smi_lib/commit/8e03d100354a90a9121cb16c6ad6a40bdd81533d

AngryLoki avatar May 10 '24 15:05 AngryLoki

It looks like this was fixed in 6.2

Mystro256 avatar Aug 08 '24 19:08 Mystro256