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

Incorrect naming in parameter pack expansion #506

Closed
pixeldexter opened this issue Oct 26, 2022 · 1 comment
Closed

Incorrect naming in parameter pack expansion #506

pixeldexter opened this issue Oct 26, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@pixeldexter
Copy link

https://cppinsights.io/s/5ced24b2

So, this code
template<class...Match>
bool search(char ch, Match&&...matchers) {
return (matchers(ch) || ...);
}
search('A', ::isalpha, ::isdigit, { lambda });

gets insighted into
bool search<... params...>(char ch, int (&matchers)(int) noexcept, int (&matchers)(int) noexcept, __lambda_12_50 && __matchers3)

Notice how first and second parameters are named 'matchers', but the third parameter is named 'matchers3'. It looks like there is an internal counter, it is just being output for lambda and not for regular function argument.

@andreasfertig
Copy link
Owner

Hello @pixeldexter,

thanks for reporting this. You're right. There is a counter, the one Clang, assigned to each parameter. C++ Insights uses this counter is based on the query whether some parameter is part of a parameter pack. This function is here InsightsHelpers.cpp.

Now for the example you provided, the check says that it is only an RValue or LValue reference (depending on the parameters). There is no glue I could find that indicates that this parameter comes from a parameter pack.

That issue will remain unfixed unless someone can show me how to get this information.

Andreas

@andreasfertig andreasfertig added the bug Something isn't working label Oct 31, 2022
andreasfertig added a commit that referenced this issue Sep 26, 2023
Fixed #506: Show suffixes for `ParmVarDecl` if it is a parameter pack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants