build: compilation error in `tinyformat.h` on Manjaro Linux #24351

issue rodentrabies opened this issue on February 15, 2022
  1. rodentrabies commented at 1:36 PM on February 15, 2022: contributor

    Here's the output from make:

    ./wallet/wallet.h:802:9:   required from ‘void wallet::CWallet::WalletLogPrintf(std::string, Params ...) const [with Params = {std::optional<int>}; std::string = std::__cxx11::basic_string<char>]’
    wallet/wallet.cpp:2931:44:   required from here
    ./tinyformat.h:291:9: error: no match for ‘operator<<’ (operand types are ‘std::ostringstream’ {aka ‘std::__cxx11::basic_ostringstream<char>’} and ‘const std::optional<int>’)
      291 |     tmp << value;
          |     ~~~~^~~~~~~~
    ./tinyformat.h:291:9: note: candidate: ‘operator<<(int, int)’ (built-in)
    

    ...

    ./wallet/wallet.h:802:9:   required from ‘void wallet::CWallet::WalletLogPrintf(std::string, Params ...) const [with Params = {std::optional<int>}; std::string = std::__cxx11::basic_string<char>]’
    wallet/wallet.cpp:2931:44:   required from here
    /usr/include/c++/11.1.0/ostream:773:5: error: no type named ‘type’ in ‘struct std::enable_if<false, std::basic_ostream<char>&>’
    In file included from /usr/include/c++/11.1.0/bits/fs_path.h:39,
                     from /usr/include/c++/11.1.0/filesystem:45,
                     from ./fs.h:11,
                     from ./wallet/wallet.h:10,
                     from wallet/wallet.cpp:6:
    ./tinyformat.h: In instantiation of ‘void tinyformat::detail::formatTruncated(std::ostream&, const T&, int) [with T = std::optional<int>; std::ostream = std::basic_ostream<char>]’:
    ./tinyformat.h:355:32:   required from ‘void tinyformat::formatValue(std::ostream&, const char*, const char*, int, const T&) [with T = std::optional<int>; std::ostream = std::basic_ostream<char>]’
    ./tinyformat.h:543:24:   required from ‘static void tinyformat::detail::FormatArg::formatImpl(std::ostream&, const char*, const char*, int, const void*) [with T = std::optional<int>; std::ostream = std::basic_ostream<char>]’
    ./tinyformat.h:519:13:   required from ‘tinyformat::detail::FormatArg::FormatArg(const T&) [with T = std::optional<int>]’
    ./tinyformat.h:975:32:   required from ‘tinyformat::detail::FormatListN<N>::FormatListN(const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::optional<int>}; int N = 2]’
    ./tinyformat.h:1028:20:   required from ‘tinyformat::detail::FormatListN<sizeof... (Args)> tinyformat::makeFormatList(const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::optional<int>}]’
    ./tinyformat.h:1064:37:   required from ‘void tinyformat::format(std::ostream&, const char*, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::optional<int>}; std::ostream = std::basic_ostream<char>]’
    ./tinyformat.h:1073:11:   required from ‘std::string tinyformat::format(const char*, const Args& ...) [with Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::optional<int>}; std::string = std::__cxx11::basic_string<char>]’
    

    Same with clang:

    /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../include/c++/11.1.0/ostream:276:7: note: candidate function not viable: no known conversion from 'const std::optional<int>' to 'std::basic_ostream<char>::__streambuf_type *' (aka 'basic_streambuf<char, std::char_traits<char>> *') for 1st argument
          operator<<(__streambuf_type* __sb);
          ^
    In file included from wallet/wallet.cpp:6:
    In file included from ./wallet/wallet.h:10:
    In file included from ./fs.h:8:
    ./tinyformat.h:291:9: error: invalid operands to binary expression ('std::ostringstream' (aka 'basic_ostringstream<char>') and 'const std::optional<int>')
        tmp << value;
        ~~~ ^  ~~~~~
    
  2. rodentrabies added the label Bug on Feb 15, 2022
  3. rodentrabies renamed this:
    build: compilation error
    build: compilation error in `tinyformat.h` on Manjaro Linux
    on Feb 15, 2022
  4. MarcoFalke commented at 1:55 PM on February 15, 2022: member

    Which commit? git log -1

  5. rodentrabies commented at 2:10 PM on February 15, 2022: contributor

    @MarcoFalke that actually gave me an idea that I just confirmed: I was debugging my changes in #18554 on top of current master and apparently it's my changes that cause the build failure. Sorry for the noise. Closing.

  6. rodentrabies closed this on Feb 15, 2022

  7. DrahtBot locked this on Feb 15, 2023
Labels

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-05-02 21:13 UTC

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