Created on 2019-08-28.00:00:00 last changed 16 months ago
Proposed resolution (approved by CWG 2022-11-10):
Change in 7.7 [expr.const] paragraph 6 as follows:
For the purposes of determining whether an expression E is a core constant expression, the evaluation ofa call tothe body of a member function of std::allocator<T> as defined in 20.2.10.2 [allocator.members], where T is a literal type,does not disqualify E from being a core constant expression, even if the actual evaluation of such a call would otherwise fail the requirements for a core constant expressionis ignored. Similarly, the evaluation ofa call tothe body of std::construct_at or std::ranges::construct_at(27.11.8 [specialized.construct]) does not disqualify E from being a core constant expression unless the first argument, of type T*, does not point to storage allocated with std::allocator<T> or to an object whose lifetime began within the evaluation of E, or the evaluation ofis considered to include only the underlying constructorcall disqualifies E from being a core constant expressioncall if the first argument (of type T*) points to storage allocated with std::allocator<T> or to an object whose lifetime began within the evaluation of E.
CWG telecon 2022-10-21:
The references to destroy_at were removed in an unrelated update to the Working Draft. Also, restore the reference to local objects whose lifetime began within E.
Suggested resolution [SUPERSEDED]:
Replace the entirety of 7.7 [expr.const] paragraph 6 with the following:
For the purposes of determining whether an expressionEis a core constant expression, the evaluation ofa call tothe body of a member function of std::allocator<T> as defined in 20.2.10.2 [allocator.members], where T is a literal type,does not disqualify E from being a core constant expression, even if the actual evaluation of such a call would otherwise fail the requirements for a core constant expressionis ignored. Similarly, the evaluation ofa call tothe body of std::destroy_at, std::ranges::destroy_at, std::construct_at, or std::ranges::construct_at(27.11.8 [specialized.construct]) does not disqualify E from being a core constant expression unless the first argument, of type T*, does not point to storage allocated with std::allocator<T> or to an object whose lifetime began within the evaluation of E, or the evaluation ofis considered to include only the underlying constructorcall disqualifies E from being a core constant expression(for the functions construct_at) or destructor (for the functions destroy_at) call if the first argument (of type T*) points to storage allocated with std::allocator<T>.
[Accepted as a DR at the November, 2022 meeting.]
7.7 [expr.const] paragraph 5 attempts to describe allowable allocation/deallocation calls in terms of what could be called “core constant subexpressions,” but the actual definition of a core constant expression in paragraph 4 is in terms of evaluation.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-07-16 13:00:43 | admin | set | status: open -> c++23 |
2023-07-16 13:00:43 | admin | set | status: drwp -> open |
2023-02-18 18:43:04 | admin | set | status: dr -> drwp |
2022-11-25 05:14:04 | admin | set | status: ready -> dr |
2022-11-10 22:06:59 | admin | set | status: review -> ready |
2022-11-10 22:06:59 | admin | set | status: review -> review |
2022-11-10 22:06:59 | admin | set | status: review -> review |
2022-11-10 22:06:59 | admin | set | status: review -> review |
2022-11-10 20:32:58 | admin | set | messages: + msg7017 |
2022-11-10 20:32:58 | admin | set | messages: + msg6998 |
2022-10-30 06:43:13 | admin | set | status: ready -> review |
2022-10-30 06:43:13 | admin | set | status: ready -> ready |
2022-10-30 06:43:13 | admin | set | status: ready -> ready |
2022-10-30 06:43:13 | admin | set | status: open -> ready |
2022-02-18 07:47:23 | admin | set | messages: + msg6718 |
2019-08-28 00:00:00 | admin | create |