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

2023-01-15


2309. Restrictions on nested statements within constexpr functions

Section: 9.2.6  [dcl.constexpr]     Status: CD5     Submitter: Faisal Vali     Date: 2016-07-30

[Accepted as a DR at the February, 2019 meeting.]

Section 9.2.6 [dcl.constexpr] bullet 3.4 specifies a list of constructs that that the body of a constexpr function shall not contain. However, the meaning of the word “contain” is not clear. For example, are things appearing in the body of a nested constexpr lambda “contained” in the body of the constexpr function?

Proposed resolution (November, 2018):

  1. Add the following two paragraphs after Clause 8 [stmt.stmt] paragraph 1:

  2. ...The optional attribute-specifier-seq appertains to the respective statement.

    A substatement of a statement is one of the following:

    [Note: The compound-statement of a lambda-expression is not a substatement of the statement (if any) in which the lambda-expression lexically appears. —end note]

    A statement S1 encloses a statement S2 if

  3. Delete the following sentence from 8.5 [stmt.select] paragraph 1:

  4. In Clause 8 [stmt.stmt], the term substatement refers to the contained statement or statements that appear in the syntax notation.
  5. Change 9.2.6 [dcl.constexpr] bullet 3.3 as follows:

  6. The definition of a constexpr function shall satisfy the following requirements: