Skip to content
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

C++, improve requires clause support (#10286 update) #10703

Merged
merged 7 commits into from Jul 24, 2022

Conversation

jakobandersen
Copy link
Contributor

Rebased and updated version of #10286.

@jakobandersen jakobandersen added type:enhancement enhance or introduce a new feature domains:cpp labels Jul 24, 2022
@jakobandersen jakobandersen added this to the 5.2.0 milestone Jul 24, 2022
@jakobandersen jakobandersen self-assigned this Jul 24, 2022
jbms and others added 7 commits July 24, 2022 21:37
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 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.

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.
@jakobandersen jakobandersen merged commit e867201 into sphinx-doc:5.x Jul 24, 2022
@jakobandersen jakobandersen deleted the cpp_requires_clause branch July 24, 2022 20:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
domains:cpp type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants