This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


2831. Non-templated function definitions and requires-clauses

Section: 9.3.1  [dcl.decl.general]     Status: DRWP     Submitter: Krystian Stasiowski     Date: 2020-04-13

[Accepted as a DR at the March, 2024 meeting.]

(From editorial issue 3936.)

Subclause 9.3.1 [dcl.decl.general] paragraph 4 specifies:

The optional requires-clause in an init-declarator or member-declarator shall be present only if the declarator declares a templated function (13.1 [temp.pre]). ...

This rule does not address function definitions, because those have neither an init-declarator nor a member-declarator.

Proposed resolution (approved by CWG 2024-03-20):

Change in 9.5.1 [dcl.fct.def.general] paragraph 1 as follows:

... The optional attribute-specifier-seq in a function-definition appertains to the function. A virt-specifier-seq can be part of a function-definition only if it is function-definition with a virt-specifier-seq shall be a member-declaration (11.4 [class.mem]). A function-definition with a requires-clause shall define a templated function.