Skip to content

Commit cb7d105

Browse files
Collect pending Changes entries for 2026-11-13 []
1 parent 9f8407d commit cb7d105

2 files changed

Lines changed: 26 additions & 25 deletions

File tree

‎src/Changes‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
Version 7.1
22

3+
11/13/26 [GH #520]
4+
Lowering of <=> and the evaluation of its operands
5+
6+
For floating-point operands, the lowering of <=> for the C-generating back
7+
end tested the right operand for a NaN before evaluating the left operand,
8+
using a short-circuit "||". When the right operand was a NaN, the left
9+
operand was therefore not evaluated, and its side effects were lost. Also,
10+
an operand without side effects could be read by the NaN test before the
11+
other operand was evaluated, and by the comparisons after it. If the other
12+
operand changed it, the result could then be "equivalent" for a NaN. For
13+
example, with --c++20:
14+
15+
#include <compare>
16+
17+
float x(), y();
18+
auto f() { return x() <=> y(); } // Previously x() was not called when
19+
// y() returned a NaN.
20+
21+
float g, h(); // h() modifies g.
22+
auto k() { return h() <=> g; } // Previously could be "equivalent"
23+
// when h() stores a NaN into g.
24+
25+
Each operand is now evaluated exactly once, and the NaN test and the
26+
comparisons use the same operand values.
27+
28+
329
11/12/26 [GH #368]
430
C++26: Allowing exception throwing in constant evaluation
531

‎src/pending_changes/gh-520-spaceship-nan-eval-order.txt‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)