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

[dcl.fct.def.general] Non-templated functions cannot have a requires-clause CWG2831 #3936

Closed
wants to merge 1 commit into from

Conversation

sdkrystian
Copy link
Contributor

CA378 intended to prohibited constraining non-templated functions. As a result, the following wording was changed in [dcl.decl] p4:

The optional requires-clause in an init-declarator or member-declarator shall be present only if the declarator declares a templated function.

Consider a function-definition. It has neither an init-declarator nor a member-declarator, and the "a function definition must be a valid declaration" rule doesn't account for the requires-clause.

I think the cleanest way to fix this is to add a sentence to [dcl.fct.def.general] p3 explicitly prohibiting this rather than dancing around the "definition must be a valid declaration" rule as context would have to be accounted for.

@jensmaurer
Copy link
Member

I would prefer if we could inherit the rules for declarations into the function-definition case instead of re-stating the rules. (There are certainly other rules for requires-clause that apply to both definitions and only-declarations.)

@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 12, 2023

CWG meeting consensus, Nov 11: This is not editorial and requires a core issue. This is fixing a bug.

@tkoeppe tkoeppe added the not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. label Nov 12, 2023
@jensmaurer
Copy link
Member

CWG2831

@jensmaurer jensmaurer changed the title [dcl.fct.def.general] Non-templated functions cannot have a requires-clause [dcl.fct.def.general] Non-templated functions cannot have a requires-clause CWG2831 Nov 23, 2023
@frederick-vs-ja
Copy link
Contributor

Superseded by #6906 (5b089c3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants