AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb
[BUG] Vec3H Grid Registration no longer builds on ToT master
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 774
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 34
Description
To reproduce, add the following registration to vdb_print/main.cc:
`openvdb::Grid::Type>::registerGrid();`
This will fail to build with a `no match for operator+` error on GCC 7.3.1 but building with Clang 16 reveals more information:
```
openvdb/openvdb/math/Vec3.h:540:43: note: candidate template ignored: requirement 'std::is_arithmetic_v' was not satisfied [with S = float, T = openvdb::v11_0::math::internal::half]
inline Vec3::type> operator+(const Vec3 &v, S scalar)
```
This appears to be due to #1688 because of the `enable_if` because `std::is_arithmetic` is true for a hardcoded list of system types that does not include half.
I've attempted to come up with a fix, but I've ran into two issues so far. Specializing `std::is_arithmetic` is undefined behavior, so we'll need to define an alternative template check. Secondly, this would create a circular dependency of sorts between `Math.h` and `Types.h`, since the latter is where the `half` type, either internal to OpenVDB or externally imported from Imath, is defined.
Contributor guide
Research direction
Start with the registration example in vdb_print/main.cc and reproduce the build failure with GCC 7.3.1 or Clang 16. Read the operator overloads around openvdb/openvdb/math/Vec3.h:540, then trace the related definitions and dependency concerns in Math.h and Types.h. Done means the Vec3H Grid registration builds successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100