Skip to content

Commit

Permalink
Fix Clang Template errors (#1977)
Browse files Browse the repository at this point in the history
Upcoming versions of Clang/LLVM change some behaviour around templating that causes OpenVDB to fail to compile.

This commit addresses two issues and allows VDB to compile again.

1. There were three instances of an unnecessary template keyword in NodeManager.h that were not followed by a template call, and therefore are illegal to the compiler.

2. GridBuilder.h had a template call to a non-existent method. This was not previously validated, but is now validated. Switching the symbol from `isActive` to `isOn` per Ken's review.

See the [changelog](https://releases.llvm.org/19.1.0/tools/clang/docs/ReleaseNotes.html#improvements-to-clang-s-diagnostics:~:text=Clang%20now%20looks%20up%20members%20of%20the%20current%20instantiation%20in%20the%20template%20definition%20context%20if%20the%20current%20instantiation%20has%20no%20dependent%20base%20classes.) for Clang and the associated [PR for the second point above](llvm/llvm-project#84050)

Signed-off-by: Dhruv Govil <dgovil2@apple.com>
  • Loading branch information
dgovil authored Dec 5, 2024
1 parent 7d44132 commit 930c3ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nanovdb/nanovdb/tools/GridBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ struct LeafNode
ValueIterator& operator=(const ValueIterator&) = default;
ValueType operator*() const { NANOVDB_ASSERT(*this); return mParent->mValues[mPos];}
Coord getCoord() const { NANOVDB_ASSERT(*this); return mParent->offsetToGlobalCoord(mPos);}
bool isActive() const { NANOVDB_ASSERT(*this); return mParent->isActive(mPos);}
bool isActive() const { NANOVDB_ASSERT(*this); return mParent->mValueMask.isOn(mPos);}
operator bool() const {return mPos < SIZE;}
ValueIterator& operator++() {++mPos; return *this;}
ValueIterator operator++(int) {
Expand Down
6 changes: 3 additions & 3 deletions openvdb/openvdb/tree/NodeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class NodeList
void operator()(const NodeRange& range) const
{
for (typename NodeRange::Iterator it = range.begin(); it; ++it) {
OpT::template eval(mNodeOp, it);
OpT::eval(mNodeOp, it);
}
}
const NodeOp mNodeOp;
Expand All @@ -348,7 +348,7 @@ class NodeList
void operator()(const NodeRange& range) const
{
for (typename NodeRange::Iterator it = range.begin(); it; ++it) {
OpT::template eval(mNodeOp, it);
OpT::eval(mNodeOp, it);
}
}
const NodeOp& mNodeOp;
Expand All @@ -373,7 +373,7 @@ class NodeList
void operator()(const NodeRange& range)
{
for (typename NodeRange::Iterator it = range.begin(); it; ++it) {
OpT::template eval(*mNodeOp, it);
OpT::eval(*mNodeOp, it);
}
}
void join(const NodeReducer& other)
Expand Down

0 comments on commit 930c3ac

Please sign in to comment.