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

The requirement of the trailing requires-clause in function-definition #4922

Open
xmh0511 opened this issue Sep 20, 2021 · 4 comments
Open

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Sep 20, 2021

Since in p1971r0 where CA378 remove constrained non-template functions, the concrete rule is located in [dcl.decl.general] p4

The optional requires-clause ([temp.pre]) in an init-declarator or member-declarator shall be present only if the declarator declares a templated function ([dcl.fct]). When present after a declarator, the requires-clause is called the trailing requires-clause. The trailing requires-clause introduces the constraint-expression that results from interpreting its constraint-logical-or-expression as a constraint-expression.

However, it is just about requires-clause in an init-declarator or member-declarator. Whereas, function-definition is a distinct grammar that differs from them. How about the trailing requires-clause in a function-definition? Should it have had the same treatment with that in [dcl.decl.general] p4?

@opensdh
Copy link
Contributor

opensdh commented Sep 20, 2021

[dcl.fct.def.general]/2 incorporates the [dcl.fct] rules.

@xmh0511
Copy link
Contributor Author

xmh0511 commented Sep 20, 2021

[dcl.fct.def.general]/2 incorporates the [dcl.fct] rules.

requires-clause is not a part of a declarator. So, when we say void declarator; or declarator; is well-formed, it didn't cover any requires-clause.

@opensdh
Copy link
Contributor

opensdh commented Sep 21, 2021

Fair point: perhaps we should expand that rule, then, to avoid other duplication.

@xmh0511
Copy link
Contributor Author

xmh0511 commented Sep 21, 2021

Fair point: perhaps we should expand that rule, then, to avoid other duplication.

Agree. We should improve [dcl.decl.general] to cover all cases.

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

2 participants