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++] Ensure consistent non-specialization template argument representation, rebased and updated #10729

Merged

Conversation

jakobandersen
Copy link
Contributor

@jakobandersen jakobandersen commented Jul 29, 2022

Rebased and updated version of #10257.
In addition the parameter pack parsing is fixed for one of the noted cases, while the other case is not valid C++ code anyway.

@jakobandersen jakobandersen added this to the 5.2.0 milestone Jul 29, 2022
@jakobandersen jakobandersen self-assigned this Jul 29, 2022
@jakobandersen jakobandersen force-pushed the cpp-template-args-non-specialized branch 2 times, most recently from df8d5b0 to 9ac4df0 Compare July 29, 2022 16:07
jbms and others added 4 commits July 29, 2022 18:14
…tation

Previously, in certain cases the template arguments of
non-specializations were retained, leading to incorrect merging of symbols.
Specifically 'template<int (X::*)(bool)...>'
@jakobandersen jakobandersen force-pushed the cpp-template-args-non-specialized branch from 9ac4df0 to 44ecc13 Compare July 29, 2022 16:14
@jakobandersen jakobandersen force-pushed the cpp-template-args-non-specialized branch from 44ecc13 to f5c21a1 Compare July 29, 2022 16:21
@jakobandersen jakobandersen merged commit c2f1f89 into sphinx-doc:5.x Jul 29, 2022
@jakobandersen jakobandersen deleted the cpp-template-args-non-specialized branch July 29, 2022 16:29
@jbms
Copy link
Contributor

jbms commented Jul 29, 2022

Thanks!

@jbms
Copy link
Contributor

jbms commented Jul 30, 2022

Per the TODO entry in my original PR you added support for parsing:

int (X::*)(bool)...

However, that does not appear to be valid C++ syntax. I believe the correct syntax is:

int (X::*... x)(bool)

https://godbolt.org/z/r34v5r6vK

@jakobandersen
Copy link
Contributor Author

It depends on which location. In the test it was as a non-type template parameter:

struct X {};

template<int (X::*)(bool)...>
void f() {}

i.e., a pack of member function pointers. The addition was to make that parse in Sphinx.
The case of int (X::*... x)(bool) already works as a function parameter in Sphinx.

@jbms
Copy link
Contributor

jbms commented Jul 30, 2022

Ah, thanks for the clarification.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants