That is my understanding also, quoting from the header you probably read too:
/// Small sets use an array of pointers allocated in the SmallPtrSet object,
/// which is treated as a simple array of pointers. When a pointer is added to
/// the set, the array is scanned to see if the element already exists, if not
/// the element is 'pushed back' onto the array.
And:
/// Inserts Ptr if and only if there is no element in the container equal to
/// Ptr. The bool component of the returned pair is true if and only if the
/// insertion takes place, and the iterator component of the pair points to
/// the element equal to Ptr.
std::pair<iterator, bool> insert(PtrType Ptr) {
How are you checking that this is the case? Make sure you’re checking the raw pointer value in each case and iterating over it in the conventional manner.
If you’re looking in a debugger, it’s possible that the internal array is full of the same pointer but the container itself knows that there are fewer valid items than that. Perhaps stack memory reuse could cause this “illusion”.
I thought perhaps you were storing something like a pointer int pair, so it would look superficially the same, but resolveCallable returns a plain pointer so this cannot be the problem.
If you cannot reproduce it in a small example, it’s possible something is corrupting the SmallPtrSet on the stack. Unlikely, but out of bounds writes can do very strange things sometimes.