From e3ee8508ac3b3ff932859652f88f4e524c656be2 Mon Sep 17 00:00:00 2001 From: Dhruv Govil Date: Tue, 3 Dec 2024 11:05:18 -0800 Subject: [PATCH] Fix Clang Template errors 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](https://github.com/llvm/llvm-project/pull/84050) Signed-off-by: Dhruv Govil --- nanovdb/nanovdb/tools/GridBuilder.h | 2 +- openvdb/openvdb/tree/NodeManager.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nanovdb/nanovdb/tools/GridBuilder.h b/nanovdb/nanovdb/tools/GridBuilder.h index 30385661d0..428215ba65 100644 --- a/nanovdb/nanovdb/tools/GridBuilder.h +++ b/nanovdb/nanovdb/tools/GridBuilder.h @@ -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) { diff --git a/openvdb/openvdb/tree/NodeManager.h b/openvdb/openvdb/tree/NodeManager.h index 27a3f82012..1023c00748 100644 --- a/openvdb/openvdb/tree/NodeManager.h +++ b/openvdb/openvdb/tree/NodeManager.h @@ -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; @@ -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; @@ -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)