ROCm / rocm_smi_lib

ROCm SMI LIB
https://rocm.docs.amd.com/projects/rocm_smi_lib/en/latest/
MIT License
111 stars 48 forks source link

remove const for ScopeGuard operator #156

Open trixirt opened 5 months ago

trixirt commented 5 months ago

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_smiutils.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

AngryLoki commented 1 month ago

@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