Skip to content

Conversation

@atakan-topaloglu
Copy link

Summary

GCC (8.5.0/10.3.0) pulls in <optional> via <algorithm>, exposing std::optional and std::nullopt.
torch-points-kernels also includes PyTorch headers, which expose c10::optional and c10::nullopt.
Because neighbors.h had using namespace std;, both namespaces leaked, causing ambiguity errors.

Root Cause

  • cpu/include/neighbors.h used using namespace std;.
  • <algorithm> transitively includes <optional>.
  • Both std::optional and c10::optional become visible, and this leads to ambiguous references.

Fix

  • Remove using namespace std; from neighbors.h.
  • Change vector<> to std::vector<> in header declarations.
  • In neighbors.cpp, add targeted imports:
    • using std::vector; using std::pair; using std::max;
  • Update knn.cpp to use std::vector<> explicitly.

Verification

Build succeeds on:

  • GCC 10.3.0 and GCC 8.5.0, CUDA 11.8, PyTorch 2.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant