Variadic macro in mempool_tests.cpp breaking MSVC build #13456

issue sipsorcery opened this issue on June 13, 2018
  1. sipsorcery commented at 11:44 AM on June 13, 2018: member

    The use of three macros with variadic arguments was added to src/test/mempool_test.cpp in https://github.com/bitcoin/bitcoin/commit/f77e1d34fd5f17304ce319b5f962b8005592501a.

    The three macros below generate a compiler error with MSVC.

    #define MK_OUTPUTS(amounts...) std::vector<CAmount>{amounts} #define MK_INPUTS(txs...) std::vector<CTransactionRef>{txs} #define MK_INPUT_IDX(idxes...) std::vector<uint32_t>{idxes}

    The easy fix is to add a ',' after the named argument as per:

    #define MK_OUTPUTS(amounts,...) std::vector<CAmount>{amounts} #define MK_INPUTS(txs,...) std::vector<CTransactionRef>{txs} #define MK_INPUT_IDX(idxes,...) std::vector<uint32_t>{idxes}

    I don't know if that will break any other compilers.

    If I had a spare 198 Swiss Francs I'd buy the C standard and check which is the correct approach, https://www.iso.org/standard/57853.html, but I don't.

  2. fanquake added the label Windows on Jun 13, 2018
  3. laanwj closed this on Jun 13, 2018

  4. laanwj referenced this in commit b2221381e7 on Jun 13, 2018
  5. UdjinM6 referenced this in commit 67a485143e on Jun 20, 2021
  6. UdjinM6 referenced this in commit 2abcb1049e on Jun 24, 2021
  7. UdjinM6 referenced this in commit 26915c7ba8 on Jun 26, 2021
  8. UdjinM6 referenced this in commit d69958c64b on Jun 26, 2021
  9. UdjinM6 referenced this in commit 8f70db248e on Jun 26, 2021
  10. UdjinM6 referenced this in commit c1a84f6d59 on Jun 28, 2021
  11. MarcoFalke locked this on Sep 8, 2021
  12. gades referenced this in commit d2146d2a3e on May 24, 2022

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-04-17 03:14 UTC

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