[wip,nomerge,rfc] build: Require C++23 compiler #36033

pull maflcko wants to merge 8 commits into bitcoin:master from maflcko:2608-cpp23 changing 50 files +112 −280
  1. maflcko commented at 9:06 AM on August 20, 2026: member

    C++23 for Bitcoin Core is mostly a "style update" on top of C++20. However, the workarounds to avoid C++23 keep accumulating and some parts of the code already use C++23 features, such as lambda attributes (https://github.com/bitcoin-core/libmultiprocess/commit/bdd0cd69418d189f62699d274a751cbf6d36bb43).

    I don't know when it is fine to switch, but at some point, I think it is fine to require a C++23 compiler, so that new stuff is unlocked. Of course this requires bumping the minimum required compiler versions:

    • GCC: 13
    • Clang: 19

    There are some C++23 features that aren't implemented (such as <stacktrace> not really shipped in any vanilla stdlib today), or e.g. ranges::starts_with not implemented until libstdc++-16. But overall I think we are better off using C++23 without those few features instead of waiting longer?

  2. DrahtBot renamed this:
    [wip,nomerge,rfc] build: Require C++23 compiler
    [wip,nomerge,rfc] build: Require C++23 compiler
    on Aug 20, 2026
  3. DrahtBot commented at 9:06 AM on August 20, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36033.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Concept ACK l0rinc

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36160 (refactor: Minor improvements to HTTP unit tests by hodlinator)
    • #36052 (ci: Doc: Move all config comments right next to the option they explain by maflcko)
    • #36042 (build: Bump g++ minimum supported version to 13 by maflcko)
    • #35998 (wallet: Handle or explicitly ignore WalletBatch write failures by achow101)
    • #35752 (wallet: make encryption state updates atomic by l0rinc)
    • #35445 (wallet, descriptor: Revert StringType::COMPAT for Miniscript expressions and drop the concept of a Descriptor ID that can be validated by achow101)
    • #34909 (wallet, refactor: modularise wallet by extracting out legacy wallet migration by rkrux)
    • #31507 (build: Use clang-cl to build on Windows natively by hebasto)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where comparison-specific test macros should replace generic comparisons:

    • [src/test/util_expected_tests.cpp] BOOST_CHECK_THROW((void)e.value(), std::bad_expected_access<std::string>); -> Prefer BOOST_CHECK_EXCEPTION with a predicate that checks the exception details, if available, instead of only asserting the generic exception type.
    • [src/test/util_expected_tests.cpp] BOOST_CHECK_THROW(void_e.value(), std::bad_expected_access<std::string>); -> Prefer BOOST_CHECK_EXCEPTION with a predicate that checks the exception details, if available, instead of only asserting the generic exception type.

    <sup>2026-08-24 14:55:56</sup>

  4. maflcko marked this as a draft on Aug 20, 2026
  5. maflcko force-pushed on Aug 20, 2026
  6. DrahtBot added the label CI failed on Aug 20, 2026
  7. DrahtBot commented at 10:17 AM on August 20, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task NetBSD Cross: https://github.com/bitcoin/bitcoin/actions/runs/32352184973/job/96373551351</sub> <sub>LLM reason (✨ experimental): CI failed due to a C++ build error: std::ranges::views::zip is not available (no member named 'zip' in namespace 'std::ranges::views').</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  8. maflcko force-pushed on Aug 21, 2026
  9. l0rinc commented at 5:08 PM on August 21, 2026: contributor

    Concept ACK

  10. hebasto commented at 4:34 PM on August 23, 2026: member

    edede385cab47020124bba6db98d69319168afb5

    iwyu incorrectly suggests to remove the util/expected include

    This looks like IWYU's "Automatic re-export: function return values" heuristics in action.

  11. maflcko force-pushed on Aug 24, 2026
  12. build: Require C++23 compiler c895086a33
  13. util: Remove ALWAYS_FALSE type b70b939dd3
  14. compat: Use std::byteswap a5e1fa71bb
  15. test: Adjust util::Expected tests for C++23
    1) value() might be marked [[nodiscard]], so add the missing (void),
       where the value is ignored.
    
    2) std::expected::value() must be able to throw
       std::bad_expected_access<E> if the expected contains an error. That
       requires copying the error type, which is not possible in this unit
       test that uses a non-copyable error type.
    
       Fix it by using the non-throwing value accessor.
    3d7742cbbd
  16. util: Use std::expected 5f5d9b1653
  17. refactor: Use std::views::zip in btck import blocks a22fc2ee98
  18. refactor: Make iwyu happy
    IWYU will now apply the
    https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhatIsAUse.md#automatic-re-export-function-return-values
    heuristic.
    19f2a55d73
  19. maflcko force-pushed on Aug 24, 2026
  20. refactor: clang-tidy readability-container-contains for C++23 450acb901e
  21. maflcko force-pushed on Aug 24, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-09-09 07:56 UTC