CWG Issue 2479 (original) (raw)

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

2025-11-05


2479. Missing specifications for consteval and constinit

Section: 6.10.3.1 [basic.start.main]Status: CD6Submitter: Davis HerringDate: 2020-10-09

[Accepted as a DR at the June, 2021 meeting.]

There are several places where the constevaland/or constinit keywords should be mentioned but are not:

6.10.3.1 [basic.start.main] paragraph 3:

A program that defines mainas deleted or that declares mainto be inline, static, or constexpris ill-formed.

9.3.4.1 [dcl.meaning.general] paragraph 2:

A static, thread_local,extern, mutable, friend,inline, virtual, constexpr, or typedef specifier or an explicit-specifier applies directly to each declarator-id in an _init-declarator-list_or member-declarator-list...

11.4.5.1 [class.ctor.general] paragraph 1:

...In a constructor declaration, each decl-specifier in the optional decl-specifier-seq shall be friend,inline, constexpr, or an explicit-specifier.

Proposed resolution, May, 2021:

  1. Change 6.10.3.1 [basic.start.main] paragraph 3 as follows:

...A program that defines main as deleted or that declares main to be inline, static, or constexpr, or constevalis ill-formed...

  1. Change 9.3.4.1 [dcl.meaning.general] paragraph 4 as follows:

A static, thread_local, extern,mutable, friend, inline,virtual, constexpr, consteval,constinit, or typedef specifier or an explicit-specifier applies directly to each declarator-id in a declaration; the type specified for each declarator-id depends on both the decl-specifier-seq and its declarator.

  1. Change 11.4.5.1 [class.ctor.general] paragraph 5 as follows:

...Constructors do not have names. In a constructor declaration, each decl-specifier in the optional decl-specifier-seq shall be friend,inline, constexpr, consteval,or an explicit-specifier.