Created on 2023-07-14.00:00:00 last changed 8 months ago
CWG in Tokyo 2024-03-22
Different approaches are feasible:
In the latter cases, tag values can be preserved when performing pointer arithmetic.
The (arguably) expanded treatment of backing arrays and string literals as potentially non-unique objects in issue 2753 lead to the question how the resulting address comparisons are treated during constant evaluation.
Subclause 7.7 [expr.const] bullet 5.24 specifies:
An expression E is a core constant expression unless the evaluation of E, following the rules of the abstract machine (6.9.1 [intro.execution]), would evaluate one of the following:
- ...
- a three-way comparison (7.6.8 [expr.spaceship]), relational (7.6.9 [expr.rel]), or equality (7.6.10 [expr.eq]) operator where the result is unspecified;
- ...
This phrasing is understood to refer to explicitly unspecified outcomes only. The treatment of an example such as
constexpr bool b = "abc" == "abc";
is unclear, given that identical string literals may or may not yield distinct string literal objects.
The assumption that equality comparison of std::string_view would compare addresses as a short-cut before comparing the character sequence could not be confirmed (27.2.2 [char.traits.require], 27.3.3.8 [string.view.ops] paragraph 12).
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-04-03 20:17:04 | admin | set | messages: + msg7653 |
2023-07-14 00:00:00 | admin | create |