Skip to content

move template class member to correct TU for explicit instantiation #4643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

graydon
Copy link
Contributor

@graydon graydon commented Feb 7, 2025

During recent refactoring a single method of the template <class BucketT> class SearchableBucketListSnapshotBase -- the method SearchableBucketListSnapshotBase<BucketT>::loadKeysInternal -- got left behind in SearchableBucketList.cpp while the rest of the methods got moved to BucketListSnapshotBase.cpp.

Unfortunately all explicit template instantiations of SearchableBucketListSnapshotBase occur in BucketListSnapshotBase.cpp and they only cause instantiation of methods defined in the same TU. So the method didn't get instantiated. At least on g++.

This was covered up in CI because enabling extrachecks winds up triggering instantiations anyways. But if you turn off extrachecks, master doesn't currently compile on g++.

This fixes the bug by moving the method to the right TU.

@graydon graydon requested a review from SirTyson February 7, 2025 03:13
Copy link
Contributor

@SirTyson SirTyson left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for tracking this down! Apologies for introducing some templated complexity with this one...

@SirTyson SirTyson added this pull request to the merge queue Feb 7, 2025
@graydon
Copy link
Contributor Author

graydon commented Feb 7, 2025

@SirTyson I appreciate your ongoing efforts to keep well-factored what has turned into a real house of mirrors! At some point when the dust has settled it might be useful to draw an ascii-art diagram of all the classes in bucket/ just to help orient future readers :)

Merged via the queue into stellar:master with commit c99641d Feb 7, 2025
13 checks passed
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.

2 participants