Closed correaa closed 1 year ago
Apparently nvcc warning 544-D is the same as icc warning 597, which is disabled here: https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/iterator.hpp#L13
If you know what ifdefs/pragmas to use for nvcc, I'll add it.
Yes, here it is for nvcc, nvc++ and intel
#if defined __INTEL_COMPILER or defined __NVCOMPILER
#pragma diagnostic push
#pragma diag_suppress = conversion_function_not_usable
#elif defined __NVCC__
#pragma nv_diagnostic push
#pragma nv_diag_suppress = conversion_function_not_usable
#endif
... offending conversion code
#if defined __INTEL_COMPILER or defined __NVCOMPILER
#pragma diagnostic pop
#elif defined __NVCC__
#pragma nv_diagnostic pop
#endif
I also had this problem in my own library, also when implementing iterators. At the time, I thought it was a reasonable warning so I decided to change the design to funnel conversion through constructors and class friendship.
For example https://gitlab.com/correaa/boost-multi/-/blob/master/include/multi/array_ref.hpp#L1596-1599
That perhaps added too much code and I am not so sure now if the warning was justified.
Thanks! I changed it as you proposed.
TIL about diag_suppress
.
When compiling with nvcc (11.8), several warnings are triggered:
(in my experience this type of warning happens when trying to define conversion operators that explicitly or accidentally convert to base classes)