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


2388. Applicability of contract-attribute-specifiers

Section: 9.12.1  [dcl.attr.grammar]     Status: NAD     Submitter: Aaron Ballman     Date: 2018-10-24

According to 9.12.1 [dcl.attr.grammar] paragraph 5,

Each attribute-specifier-seq is said to appertain to some entity or statement, identified by the syntactic context where it appears ( Clause 8 [stmt.stmt], 9.1 [dcl.pre], 9.3 [dcl.decl]). If an attribute-specifier-seq that appertains to some entity or statement contains an attribute or alignment-specifier that is not allowed to apply to that entity or statement, the program is ill-formed.

This does not, but presumably should, mention contract-attribute-specifiers.

Proposed resolution (March, 2019):

Change 9.12.1 [dcl.attr.grammar] paragraph 5 as follows:

Each attribute-specifier-seq is said to appertain to some entity or statement, identified by the syntactic context where it appears (Clause 8 [stmt.stmt], 9.1 [dcl.pre], 9.3 [dcl.decl]). If an attribute-specifier-seq that appertains to some entity or statement contains an attribute, contract-attribute-specifier, or alignment-specifier that is not allowed to apply to that entity or statement, the program is ill-formed. If an attribute-specifier-seq appertains to a friend declaration (11.8.4 [class.friend]), that declaration shall be a definition. No attribute-specifier-seq shall appertain to an explicit instantiation (13.9.3 [temp.explicit]).

Rationale (July, 2019):

With the adoption of paper P1823R0, removing contracts from C++20, this issue is moot.