Skip to content

Fix a typo - #43

Open
katoue wants to merge 4 commits into
carbonengine:mainfrom
katoue:fix/pairing-heap-unlink-typo
Open

katoue wants to merge 4 commits into
carbonengine:mainfrom
katoue:fix/pairing-heap-unlink-typo

Conversation

@katoue

@katoue katoue commented Sep 16, 2026 •

Copy link
Copy Markdown

Summary

  • PairingHeap<T>::remove(nodeptr_t) called node->Unlink; (missing parentheses), which just formed an unused pointer-to-member-function expression instead of actually calling Unlink(). The node was never detached from its parent's child/sibling chain before being deleted, leaving a dangling pointer in the tree.
  • Changed to node->Unlink(); to match the correct call already used elsewhere (e.g. remove_min()'s use of DetachChildren).

Test plan

  • CI build/tests pass

AI assistance

Claude Code (claude.com/claude-code) was used to write the tests.

@ccpgames-carbon

ccpgames-carbon commented Sep 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CCP-Aporia

Copy link
Copy Markdown
Member

Hi @katoue,

Thank you for the contribution, this is a great find. Clearly there are tests missing for this class, or this wouldn't have gone unnoticed for so long. Would you mind adding at least one that covers the code path you fixed?

PS: I noticed you edited out the "Generated with Claude Code" line. As per our contribution guidelines, please disclose the use of AI.

@katoue

katoue commented Oct 1, 2026

Copy link
Copy Markdown
Author

Done — added tests in tests/CcpPairingHeap.cpp covering remove() on a non-root node, the root node, and removing all nodes one by one. Also updated the PR description to disclose AI assistance.

@CCP-Aporia

Copy link
Copy Markdown
Member

Thank you for adding these tests. Unfortunately, the build now fails on CI with the following error:

include/CcpPairingHeap.h:403:2: error: use of undeclared identifier 'CCP_ASSERT'

Please fix this issue and test this locally on your side as well.

@katoue

katoue commented Oct 1, 2026

Copy link
Copy Markdown
Author

Fixed — added #include "CcpCore.h" to pull in CCP_ASSERT. Sorry about that.

@CCP-Aporia CCP-Aporia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the inclusion of CcpAssert.h should really happen in CcpPairingHeap.h: that header already uses the macro, and therefore any consumers may run into the same compilation error that the test had experienced.

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.

3 participants