Skip to content

Conversation

@rcurtin
Copy link
Member

@rcurtin rcurtin commented Apr 23, 2025

I am grudgingly thankful to CRAN for catching these errors: https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-clang/mlpack-00install.html

The actual error is:

../inst/include/mlpack/core/tree/build_tree.hpp:21:11: note: candidate template ignored: substitution failure [with TreeType = Tree]: ambiguous partial specializations of 'TreeTraits<mlpack::BinarySpaceTree<mlpack::LMetric<2>, mlpack::NeighborSearchStat<mlpack::FurthestNS>, arma::Mat<double>, mlpack::CellBound, mlpack::UBTreeSplit>>'
   21 | TreeType* BuildTree(
      |           ^
   22 |     MatType&& dataset,
   23 |     std::vector<size_t>& oldFromNew,
   24 |     const std::enable_if_t<TreeTraits<TreeType>::RearrangesDataset>* = 0)

It appears that clang does not like the series of partial template specializations that we use for different TreeTraits. I worked around this issue by, for each individual tree type, making only one specialization of TreeTraits, and using other traits classes internally (like IsRPTreeSplitType<> and a few others I added) to set the boolean values in TreeTraits appropriately, depending on the configuration of the tree.

There is no actual behavior change, this is just a refactoring that makes compilation work on newer clang versions.

I also fixed a few unused variable warnings and other warnings that clang emitted.

@rcurtin
Copy link
Member Author

rcurtin commented Apr 23, 2025

I will release a bugfix version of mlpack after this, so that I can upload the fixed version to CRAN.

@eddelbuettel
Copy link
Contributor

I am grudgingly thankful to CRAN

Well put.

@rcurtin rcurtin marked this pull request as draft April 23, 2025 17:30
@rcurtin
Copy link
Member Author

rcurtin commented Apr 23, 2025

I broke something strange here... I'll convert to a draft until I get it fixed...

@rcurtin rcurtin marked this pull request as ready for review May 10, 2025 12:50
@rcurtin
Copy link
Member Author

rcurtin commented May 10, 2025

Ok, I managed to figure out the subtle issue here on Apple clang and this is now ready for review.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second approval provided automatically after 24 hours. 👍

@rcurtin rcurtin merged commit 17311cd into mlpack:master May 13, 2025
14 of 15 checks passed
@rcurtin rcurtin deleted the fix-clang20-compilation branch May 13, 2025 17:29
@rcurtin rcurtin mentioned this pull request May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants