Building VTK 9.6.2 with WebGPU enabled on Windows / MSVC fails to compile Rendering/WebGPU/vtkWebGPUComputeBuffer.h.
Group and Binding are declared as vtkIdType members but each accessor is defined twice, once hand-written returning uint32_t, and once via vtkGetMacro returning vtkIdType:
After macro expansion each is a redefinition of GetGroup() / GetBinding() differing only by return type (uint32_t vs vtkIdType), which is ill-formed:
vtkWebGPUComputeBuffer.h(92): error C2556:
'vtkIdType vtkWebGPUComputeBuffer::GetGroup(void) const': overloaded function differs only by return type from 'uint32_t vtkWebGPUComputeBuffer::GetGroup(void) const'
vtkWebGPUComputeBuffer.h(92): error C2371: 'vtkWebGPUComputeBuffer::GetGroup': redefinition; different basic types
Are we doing something wrong? Cause that must have gone through CI/CD at some point.
We discovered that VTK_USE_FUTURE_CONST=ON triggers it. Without it, vtkGetMacro expands to a non-const getter which doesn’t interfere with the const ones. We can disable it for now but this is a potential bug.
@jaswantp It looks like @tclabault wrote this originally, but we should investigate it. A method changing return type based on const is confusing anyways.
I dont think VTK_USE_FUTURE_CONST=ON is reader for prime time yet, it is only tested independantly by @seanm , but maybe will be turned on in some CI in the coming months.
That said, VTK_USE_FUTURE_BOOL could use the same treatment as some vtkSetClampMacro which are now bool are trying to force int clamping values resulting in a compile time warning (or error if treated as such).
Well, I only use a subset of VTK of course, but we’ve been shipping our app built with VTK_USE_FUTURE_CONST for years. It’s ready for prime time in that sense.