Avoid depending on argument default constructors #41

pull ryanofsky wants to merge 1 commits into bitcoin-core:master from ryanofsky:pr/nodefault changing 1 files +12 −19
  1. ryanofsky commented at 12:08 AM on December 18, 2020: collaborator

    CTransaction default constructor was removed in https://github.com/bitcoin/bitcoin/commit/faac31521bb7ecbf999541cf918d3750ff589de4 which exposed two places where libmultiprocess was inadvertently assuming default constructors were defined.

    In both places, it would never actually call the default constructor at runtime, just rely on it being present during compile time code generation.

    In the first case, compiler would fail while trying to figure out the type of std::invoke_result_t<EmplaceFn> where EmplaceFn called make_shared<CTransaction>(). This was fixed by just the moving expression into an unexpanded template method.

    In the second case code was calling Optional<CTransaction>::emplace() to default-initialize CTransaction& output-arguments. It was fixed by moving into a constexpr-if that would be known to be false for output arguments at compile time.

  2. Avoid depending on argument default constructors
    CTransaction default constructor was removed in
    faac31521bb7ecbf999541cf918d3750ff589de4
    https://github.com/bitcoin/bitcoin/pull/20588 which exposed two places
    where libmultiprocess was inadvertently assuming default constructors
    were defined.
    
    In both places, it would never actually call the default constructor
    at runtime, just rely on it being present during compile time code
    generation.
    
    In the first case, compiler would fail while trying to figure out the type of
    `std::invoke_result_t<EmplaceFn>` where EmplaceFn called
    `make_shared<CTransaction>()`. This was fixed by just the moving expression
    into an unexpanded template method.
    
    In the second case code was calling Optional<CTransaction>::emplace() to
    default-initialize CTransaction& output-arguments. It was fixed by
    moving into a constexpr-if that would be known to be false for output
    arguments at compile time.
    0e97be35f9
  3. ryanofsky merged this on Dec 18, 2020
  4. ryanofsky closed this on Dec 18, 2020

  5. ryanofsky referenced this in commit 8877892266 on Dec 18, 2020
  6. ryanofsky referenced this in commit 29e574aed8 on Jan 28, 2021
  7. ryanofsky referenced this in commit c4ee00e947 on Jan 28, 2021
  8. ryanofsky referenced this in commit 97232e7c62 on Mar 4, 2021
  9. ryanofsky referenced this in commit b1cacee1b4 on Mar 4, 2021
  10. ryanofsky referenced this in commit 1ecf3dcc52 on Mar 4, 2021
  11. ryanofsky referenced this in commit 35cfc59500 on Mar 17, 2021
  12. ryanofsky referenced this in commit 7e43e7a556 on Mar 17, 2021
  13. ryanofsky referenced this in commit 1930323ae9 on Mar 17, 2021
  14. ryanofsky referenced this in commit 4cb21574b8 on Mar 30, 2021
  15. ryanofsky referenced this in commit 85f47de8f0 on Mar 30, 2021
  16. ariard referenced this in commit 14ec1dec98 on Apr 6, 2021
  17. ryanofsky referenced this in commit f1f62325ec on Apr 23, 2021
  18. ryanofsky referenced this in commit 5d62d7f6cd on Apr 23, 2021
  19. bitcoin-core locked this on Jun 25, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 13:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me