Story: MSVC C1202 constexpr depth fixes

Table of Contents

This page documents a story in Sprint 17. It captures the goal, current status, acceptance criteria, and the tasks that compose it.

Goal

Eliminate MSVC C1202 "constexpr evaluation exceeded" errors across all components. Primary fix: decompose the trade struct into rfl::Flatten sub-structs. Secondary: raise /constexpr:depth and /constexpr:steps limits where needed; undo temporary TU splits once the struct fix lands; remove the now-redundant workaround pragmas.

Status

Field Value
State DONE
Parent sprint Sprint 17
Now Completed 2026-05-21.
Waiting on None.
Next None.
Last touched 2026-05-21

Acceptance

  • All tasks complete; PR-by-PR breakdown in git log.

Tasks

Task State Start End Description
Task: [cmake] Raise MSVC constexpr limits to fix C1202 on rfl-reflected structs DONE 2026-05-22 2026-05-22 - `fra_instrument` has 18 fields; `rfl`'s duplicate-field-names check performs an O(N²) constexpr expansion that exhaust
Task: [cmake] Raise MSVC constexpr depth to 2048 for rfl trading types DONE 2026-05-22 2026-05-22 - `ores.qt.api` was failing to compile `ClientManager.cpp` on Windows with C1202 ("recursive type or function dependency
Task: [cmake] Fix CI: export conversion_error and raise MSVC constexpr depth DONE 2026-05-22 2026-05-22 Two separate CI failures introduced on main by recent merges:
Task: [qt] Fix MSVC C1202 by splitting ClientManager into focused TUs DONE 2026-05-22 2026-05-22 - MSVC `fatal error C1202` fires when `rfl` reflects too many complex types in a single translation unit — `ClientManage
Task: [hotfix] Fix Windows build: C1202 TU split and workflow.api export DONE 2026-05-22 2026-05-22 Two Windows build failures fixed in this PR:
Task: [hotfix] Fix boost::diagnostic_information compile error in ClientManagerTradeDetail DONE 2026-05-22 2026-05-22 - `ClientManagerTradeDetail.cpp:75` calls `boost::diagnostic_information(e)` which requires `<boost/exception/diagnostic
Task: [trading] Decompose trade into rfl::Flatten sub-structs to fix MSVC C1202 DONE 2026-05-22 2026-05-22 - Root cause: MSVC C1202 fires in any TU that reflects both `get_trades_response` (a `vector<trade>`) and another large
Task: [qt] Undo ClientManager TU split now that trade is decomposed DONE 2026-05-22 2026-05-22 - The C1202 TU split from PRs #754 and #757 isolated `listTrades` and `getTradeDetail` into separate files to stay under
Task: [hotfix] Restore two-phase rfl parse in getTradeDetail to fix MSVC C1202 DONE 2026-05-22 2026-05-22 PR #763 merged `getTradeDetail` back into `ClientManagerTrades.cpp` and replaced the two-phase rfl parse with a single `
Task: [qt] Raise MSVC constexpr limits for ores.qt.api to fix C1202 DONE 2026-05-22 2026-05-22 - `ClientManagerTrades.cpp` calls `rfl::json::read` with the `trade_instrument` variant (8 non-monostate alternatives, ~
Task: [trading] Raise MSVC /constexpr:depth to 100000 to fix C1202 in ores.qt.api DONE 2026-05-22 2026-05-22 - The `ores.trading.api` target sets `/constexpr:depth` as `PUBLIC`, meaning it propagates to all consumers and the last
Task: [windows] Fix MSVC linker error and C1202 in trade variant DONE 2026-05-22 2026-05-22 - Error 1 (LNK2001 – `ores.refdata.service`): `host::execute` was missing its Windows DLL export annotation. Added `expo
Task: [msvc] Remove MSVC C1202 workaround file splits DONE 2026-05-22 2026-05-22 Removes three sets of artificial code splits that were introduced solely to work around MSVC C1202 (constexpr budget exc
Task: [qt] Remove non-existent MSVC constexpr pragmas DONE 2026-05-22 2026-05-22 - Remove `#pragma constexpr_depth` and `#pragma constexpr_steps` from `ClientManager.cpp` and `ClientManagerTrades.cpp`

Decisions

rfl::Flatten as root-cause fix
decomposing trade into rfl::Flatten sub-structs reduces the constexpr evaluation depth MSVC encounters during reflection, addressing the root cause rather than working around it with TU splits or higher limits alone.
Revert TU splits
once rfl::Flatten landed, all ClientManager TU splits were reverted to restore the simpler file layout.

Out of scope

  • General Windows portability fixes (carried in windows_portability story).

See also

Emacs 29.1 (Org mode 9.6.6)