Skip to content

[P3816] Implement std::consteval_hash<std::meta::info> (semi-stable implementation 2) - #195

Open
fullptr wants to merge 31 commits into
bloomberg:p2996from
fullptr:consteval-hash-2
Open

[P3816] Implement std::consteval_hash<std::meta::info> (semi-stable implementation 2)#195
fullptr wants to merge 31 commits into
bloomberg:p2996from
fullptr:consteval-hash-2

Conversation

@fullptr

@fullptr fullptr commented Oct 21, 2025

Copy link
Copy Markdown

Implements https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3816r0.html in a way that is stable across repeated runs of the compiler on unchanged source code.

Provides a simpler implementation of https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3816r0.html compared to #170. The issue with the other implementation is the burden of keeping it updated; whenever a new construct becomes reflectable in the future, this implementation would also needed to be updated to account for it.

The simplest approach to defining the hash is just the hash the AST pointer that the meta::info represents, but this results in unstable values across repeat compilations. However, we can just intern these with a map to produce stable values. This implementation does not need to be updated whenever new reflections are added to the language, and re-compiling source code without changes will still yield the same hash values as required by the paper.

@fullptr fullptr changed the title Implement std::consteval_hash<std::meta::info> (simpler implementation) Implement std::consteval_hash<std::meta::info> (semi-stable implementation) Dec 14, 2025
@fullptr fullptr changed the title Implement std::consteval_hash<std::meta::info> (semi-stable implementation) [P3816] Implement std::consteval_hash<std::meta::info> (semi-stable implementation) Dec 14, 2025
@fullptr fullptr changed the title [P3816] Implement std::consteval_hash<std::meta::info> (semi-stable implementation) [P3816] Implement std::consteval_hash<std::meta::info> (semi-stable implementation 2) Dec 15, 2025
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