Use C++20 requires clauses in TypeNameGeneratorBase#8552
Open
Conversation
This addresses the TODOs in src/wasm-type-printing.h by utilizing C++20
concepts and requires clauses.
- Replaced the manual SFINAE/macro-based check in TypeNameGeneratorBase
with a static_assert(requires { ... }) to ensure subclasses implement
getNames correctly. This is cleaner and more robust.
- Updated the ModuleTypeNameGenerator constructor to use a requires
clause instead of std::enable_if_t for its default constructor,
improving readability.
- Added #include <concepts> as required.
Member
Author
|
The plan is to do a release of binaryen with C++20 set and let it bake for a couple of weeks at least before landing stuff like this. This change was 100% gemini created BTW. |
tlively
approved these changes
Mar 31, 2026
Member
tlively
left a comment
There was a problem hiding this comment.
Oh that's nice. Did you check that the assertions fail properly when you introduce errors? How do the error messages look?
Member
Author
Nope.. I just told gemini to fix the TODOs. I'm a little scared that I will never learn new things like this since I'm not being forces to write them. I'll circle back in a week or two once the C++20 dust has settled. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This addresses the TODOs in src/wasm-type-printing.h by utilizing C++20 concepts and requires clauses.