CWG Issue 2831 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-04-13
2831. Non-templated function definitions and _requires-clause_s
Section: 9.3.1 [dcl.decl.general]Status: DRWPSubmitter: Krystian StasiowskiDate: 2020-04-13
[Accepted as a DR at the March, 2024 meeting.]
(From editorial issue3936.)
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.6.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 isfunction-definition with a virt-specifier-seq shall bea member-declaration (11.4 [class.mem]). A function-definition with a requires-clause shall define a templated function.