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

CWG2942 [dcl.fct] packs in parameter-type-list #629

Open
cor3ntin opened this issue Oct 25, 2024 · 4 comments
Open

CWG2942 [dcl.fct] packs in parameter-type-list #629

cor3ntin opened this issue Oct 25, 2024 · 4 comments

Comments

@cor3ntin
Copy link

in decl.fct p4, we say

After producing the list of parameter types, any top-level cv-qualifiers modifying a parameter type are deleted when forming the function type. The resulting list of transformed parameter types and the presence or absence of the ellipsis or a function parameter pack is the function's parameter-type-list.

Emphasis mine.

It's not clear what we mean by "or a function parameter pack".
A function can have a number of parameter packs in arbitrary position, and the fact that only the trailing pack is a deduced context is irrelevant when we are not deducing anything.

Are these functions equivalent?

void f(auto..., auto) {}
void f(auto..., auto) {}

Proposed resolution (which needs further massaging)

After producing the list of parameter types, any top-level cv-qualifiers modifying a parameter type are deleted when forming the function type. The resulting list of transformed parameter types and whether each corresponding parameter-declaration is a function parameter pack and the presence or absence of the ellipsis or a function parameter pack is the function's parameter-type-list.

@cor3ntin cor3ntin changed the title [dcl.fct] packs in *parameter-type-list* [dcl.fct] packs in parameter-type-list Oct 25, 2024
@Endilll
Copy link

Endilll commented Oct 25, 2024

Regarding the proposed resolution. Given

The type of each parameter (including function parameter packs) is determined from its own parameter-declaration ([dcl.decl]).

I think whether a given parameter declaration is a pack or not is covered by the preceding wording. We can just strike the part about parameter packs where we talk about ellipsis.

@jensmaurer jensmaurer changed the title [dcl.fct] packs in parameter-type-list CWG2942 [dcl.fct] packs in parameter-type-list Oct 26, 2024
@jensmaurer
Copy link
Member

CWG2942

@cor3ntin
Copy link
Author

I think whether a given parameter declaration is a pack or not is covered by the preceding wording. We can just strike the part about parameter packs where we talk about ellipsis.

I am not sure this is correct. the "packness" is part of the declaration, not the type. So presumably, there needs to be some wording to propagate that.

@jensmaurer
Copy link
Member

I disagree. (Note that we're at the template level here, so "type" might be a bit more than what the rest of the type system, after instantiation, knows about.)

"The type of each parameter (including function parameter packs) is determined from its own parameter-declaration (9.3)'"

The packness is part of the parameter-declaration; if we feel something is amiss, [dcl.meaning.general] would need amendment somewhere. Suggestions welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants