Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++] Support requires-clause in more places
Previously a C++20 requires-clause was only supported on `function` declarations. However, the C++ standard allows a require-clause on class/union templates, alias templates, and variable templates, and also allows a requires clause after each template parameter list, not just the final one. This moves the requiresClause to be a property of `ASTTemplateParams` rather than `ASTDeclaration` to better match the C++ grammar and allows requires clauses in many places that are supported by C++20 but were not previously allowed by Sphinx, namely: - On class/union templates, alias templates, and variable templates - After each template parameter list, not just the last one. - After the template parameter list in template template parameters. Additionally: - This adds support for template parameters on unions. - This adds support for trailing requires clauses on functions without a template prefix. This is allowed by C++20 for non-template members of class templates. When encoding the id, the requires clause of the last template parameter list is treated specially in order to preserve compatibility with existing v4 ids.
- Loading branch information
Showing
2 changed files
with
94 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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