#36033 [wip,nomerge,rfc] build: Require C++23 compiler
https://github.com/bitcoin/bitcoin/pull/36033 · · +112/-280 in 50 files, 8 commits · labels: Needs rebase, CI failed · draft
Goal
- Eliminate custom workarounds and polyfills by requiring C++23
- Let developers use modern standard library features directly
This pull request raises the required C++ standard to C++23 across CMake, depends, and CI, bumping minimum compiler versions to GCC 13 and Clang 19. It replaces Bitcoin Core's custom util::Expected with std::expected, adopts std::byteswap and std::string::contains, and cleans up obsolete template workarounds like ALWAYS_FALSE.
Problem: Workarounds and custom polyfills to avoid C++23 continue to accumulate in the repository, while some parts of the dependency tree already use C++23 language features.
Category: Build and CI (#30 of 55)
P3 · decision needed
- P3 because bumping to C++23 is a deferrable standard upgrade with modest changes over C++20
- Reaching consensus on supported compiler baselines is needed before moving forward
Bumping the minimum compiler version to C++23 is a non-urgent transition. As maflcko noted in the description, 'C++23 for Bitcoin Core is mostly a style update on top of C++20', making this a deferrable standard upgrade that requires community consensus on supported compiler baselines.
Membership: Changes CMAKE_CXX_STANDARD to 23 in CMakeLists.txt and depends/Makefile, and bumps CI compiler requirements.
Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 1
Category: Utilities (logging, arguments, libraries) (#57 of 66)
P3 · cleanup
- P3 because replacing custom utility polyfills with standard equivalents is routine cleanup
- Simplifies internal infrastructure slightly without changing developer workflows significantly
Adopting standard library replacements for internal utilities like util::Expected and byteswap simplifies common infrastructure and removes custom code, but is non-critical cleanup.
Membership: Replaces util::Expected with std::expected, removes src/util/types.h, and replaces compat byteswap implementations with std::byteswap.
Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 1
Reviewability: Stale: Needs rebase
- Not ready for review because the PR has merge conflicts and CI is failing
The PR has merge conflicts with master and CI is currently failing.
Author status: active
Resolved concerns:
- hebasto noted an include change was caused by include-what-you-use heuristics on function return values.
Agreement: Positive
- Initial sentiment is positive on exploring the compiler upgrade
- Concept approval without stated reasons (l0rinc)
- Minor feedback on header include heuristics (hebasto)
Positive: concept ACK from l0rinc with no objections, though marked RFC and nomerge
l0rinc offered a Concept ACK, hebasto provided minor review feedback, and no contributors have opposed exploring the compiler bump.
- l0rinc gave a Concept ACK on 2026-08-21
- hebasto commented on commit IWYU heuristics on 2026-08-23
Review verdicts (DrahtBot): 0
- Concept ACK: l0rinc
Dependencies
Enables:
Files
85 lines under test/bench/ci.
- src/util/expected.h +5/-117
- src/compat/byteswap.h +7/-60
- src/compat/endian.h +12/-12
- src/test/httpserver_tests.cpp +7/-7
- src/bitcoin-tx.cpp +6/-6
- src/util/types.h +0/-12
- src/test/getarg_tests.cpp +5/-5
- src/test/netbase_tests.cpp +5/-5
- src/kernel/bitcoinkernel.cpp +6/-3
- src/test/fuzz/strprintf.cpp +4/-4
- ci/test/00_setup_env_native_asan.sh +4/-3
- src/test/system_tests.cpp +3/-3
- src/test/util_expected_tests.cpp +3/-3
- doc/release-notes-36033.md +4/-0
- src/qt/askpassphrasedialog.cpp +2/-2
- src/qt/guiutil.cpp +2/-2
- src/rpc/util.cpp +2/-2
- src/wallet/rpc/encrypt.cpp +2/-2
- src/wallet/test/coinselection_tests.cpp +2/-2
- src/wallet/test/coinselector_tests.cpp +2/-2
- src/logging/timer.h +1/-2
- CMakeLists.txt +1/-1
- contrib/devtools/bitcoin-tidy/CMakeLists.txt +1/-1
- depends/Makefile +1/-1
- depends/README.md +1/-1
- src/.clang-format +1/-1
- src/bitcoin-cli.cpp +1/-1
- src/common/args.cpp +1/-1
- src/common/config.cpp +1/-1
- src/common/license_info.cpp +1/-1
- src/httpserver.cpp +1/-1
- src/i2p.cpp +1/-1
- src/qt/optionsmodel.cpp +1/-1
- src/qt/transactiondesc.cpp +1/-1
- src/rpc/net.cpp +1/-1
- src/rpc/server.cpp +1/-1
- src/test/argsman_tests.cpp +1/-1
- src/test/descriptor_tests.cpp +1/-1
- src/test/fuzz/rpc.cpp +1/-1
- src/test/fuzz/system.cpp +1/-1
- src/test/util/common.h +1/-1
- src/test/util/logging.cpp +1/-1
- src/util/strencodings.cpp +1/-1
- src/util/string.h +1/-1
- src/wallet/test/wallet_tests.cpp +1/-1
- src/wallet/wallet.cpp +1/-1
- src/index/txospenderindex.cpp +1/-0
- src/node/blockstorage.cpp +1/-0
- src/script/descriptor.cpp +0/-1
- src/util/bip32.cpp +1/-0
Card
This PR explores bumping the required C++ standard to C++23, raising compiler requirements to GCC 13 and Clang 19. It eliminates internal polyfills like util::Expected and custom byteswapping in favor of std::expected and std::byteswap, alongside applying string .contains() across the codebase. Marked as an RFC and nomerge by the author, it is currently stale due to merge conflicts and failing CI, but has received an initial Concept ACK from l0rinc.