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

2025-03-27


3012. Deviating constexpr or consteval across translation units

Section: 9.2.6  [dcl.constexpr]     Status: open     Submitter: Benjamin Sch.     Date: 2025-03-15

(From submission #683.)

Subclause 9.2.6 [dcl.constexpr] paragraph 1 specifies:

... If any declaration of a function or function template has a constexpr or consteval specifier, then all its declarations shall contain the same specifier.

This rule should not require a diagnostic if the declarations are not mutually reachable.

Possible resolution:

Change in 9.2.6 [dcl.constexpr] paragraph 1 as follows:

... If any declaration of a function or function template F has a constexpr or consteval specifier, then all its declarations shall contain the same specifier; a diagnostic is required only if a declaration of F reachable from another declaration of F deviates.