Title
Deviating constexpr or consteval across translation units
Status
open
Section
9.2.6 [dcl.constexpr]
Submitter
Benjamin Sch.

Created on 2025-03-15.00:00:00 last changed 2 weeks ago

Messages

Date: 2025-03-15.00:00:00

(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.
History
Date User Action Args
2025-03-15 00:00:00admincreate