Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Case Study: The C++20 Migration Compiled Clean. A 40-Line Property Test Found the Ordering Break.

Description and use

Migrating a library to C++20 changed the sort order of records, discovered only by a 40‑line property test. The test showed that an automated diff replaced a hand‑written operator< with a defaulted <=>, altering member order and thus the ordering.

Problem

Migrating a 2,400‑line library to C++20 changed the sort order of report records, breaking callers that relied on a specific priority‑timestamp‑name ordering.

Outcome

The property test revealed that the defaulted comparison changed the ordering, exposing a regression that unit tests missed.

Workflow

  • Snapshot existing test outputs’ SHA‑256
  • Prompt model to apply only mechanical changes
  • Apply diff and build with -std=c++20 -Wall -Wextra -Werror
  • Run existing 14 unit tests
  • Add ordering property test
  • Run whole job under ASan and UBSan

Evidence

The model’s reasoning was defensible. A defaulted <= > generates all six comparison operators, and operator< is synthesized from it.

Source

The risky 13% was a single change to Record.

  • Record date: 2026-09-09T05:15:22.782Z